Class LdClientContext
Encapsulates SDK client context when creating components.
Inherited Members
Namespace: LaunchDarkly.Sdk.Server.Subsystems
Assembly: LaunchDarkly.ServerSdk.dll
Syntax
public sealed class LdClientContext
Remarks
The SDK passes this object to component factories/configuration builders that implement the IComponentConfigurer<T> interface, to provide them with necessary configuration properties, as well as references to other components that they may need to access.
This class also has non-public properties that are relevant only to internal SDK implementation code and are not accessible to custom components.
Constructors
| Edit this page View SourceLdClientContext(string)
Basic constructor that sets only the SDK key and uses defaults for all other properties.
Declaration
public LdClientContext(string sdkKey)
Parameters
Type | Name | Description |
---|---|---|
string | sdkKey | the SDK key |
LdClientContext(string, IDataSourceUpdates, IDataStoreUpdates, HttpConfiguration, Logger, bool, ServiceEndpoints)
Constructs a new instance with only the public properties.
Declaration
public LdClientContext(string sdkKey, IDataSourceUpdates dataSourceUpdates, IDataStoreUpdates dataStoreUpdates, HttpConfiguration http, Logger logger, bool offline, ServiceEndpoints serviceEndpoints)
Parameters
Type | Name | Description |
---|---|---|
string | sdkKey | the SDK key |
IDataSourceUpdates | dataSourceUpdates | value for DataSourceUpdates, normally null |
IDataStoreUpdates | dataStoreUpdates | value for DataStoreUpdates, normally null |
HttpConfiguration | http | the HTTP configuration; if null, a default configuration is used |
Logger | logger | the base logger; if null, logging is disabled |
bool | offline | true if the SDK should be entirely offline |
ServiceEndpoints | serviceEndpoints | custom service endpoints; if null, defaults are used |
Remarks
This constructor is only for convenience in testing. It does not set internal properties that are normally computed in the LdClient constructor.
Properties
| Edit this page View SourceDataSourceUpdates
A component that IDataSource implementations use to deliver data and status updates to the SDK.
Declaration
public IDataSourceUpdates DataSourceUpdates { get; }
Property Value
Type | Description |
---|---|
IDataSourceUpdates |
Remarks
This property is only set when the SDK is calling an IDataSource factory. Otherwise it is null.
DataStoreUpdates
A component that IDataStore implementations use to deliver status updates to the SDK.
Declaration
public IDataStoreUpdates DataStoreUpdates { get; }
Property Value
Type | Description |
---|---|
IDataStoreUpdates |
Remarks
This property is only set when the SDK is calling an IDataStore factory. Otherwise it is null.
Http
The HTTP configuration for the current client instance.
Declaration
public HttpConfiguration Http { get; }
Property Value
Type | Description |
---|---|
HttpConfiguration |
Remarks
All SDK components that make HTTP requests must use this configuration unless there is a specific reason they cannot (for instance, streaming connections cannot use the ConnectTimeout property).
This property is null during early stages of SDK initialization where the HTTP configuration has not yet been created.
Logger
The base logger for all SDK components to use.
Declaration
public Logger Logger { get; }
Property Value
Type | Description |
---|---|
Logger |
Remarks
Components should use the methods of the LaunchDarkly.Logging
API to write log messages which will be output or discarded as appropriate by the logging
framework. This is the main logger for the SDK; components that want to tag their log messages
with a more specific logger name can use the SubLogger
method: for instance, if the
base logger's name is "LaunchDarkly.Sdk", an event-processing component could use
SubLogger("Events")
to get a logger whose name is "LaunchDarkly.Sdk.Events".
This property will never be null; if logging is disabled, it will be set to a stub logger that produces no output.
Offline
True if the SDK was configured to be completely offline.
Declaration
public bool Offline { get; }
Property Value
Type | Description |
---|---|
bool |
SdkKey
The configured SDK key.
Declaration
public string SdkKey { get; }
Property Value
Type | Description |
---|---|
string |
ServiceEndpoints
Defines the base service URIs used by SDK components.
Declaration
public ServiceEndpoints ServiceEndpoints { get; }
Property Value
Type | Description |
---|---|
ServiceEndpoints |