Skip to content

Commit cfd4d77

Browse files
msohailhussainMichael Ng
authored andcommitted
readme: Updated Readme (#173)
1 parent bff6667 commit cfd4d77

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,77 @@ The Optimizely client object accepts the following plug-ins:
6767
1. `IEventDispatcher` handles the HTTP requests to Optimizely. The default implementation is an asynchronous "fire and forget".
6868
2. `ILogger` exposes a single method, Log, to record activity in the SDK. An example of a class to bridge the SDK's Log to Log4Net is provided in the Demo Application.
6969
3. `IErrorHandler` allows you to implement custom logic when Exceptions are thrown. Note that Exception information is already included in the Log.
70+
4. `ProjectConfigManager` exposes method for retrieving ProjectConfig instance. Examples include `FallbackProjectConfigManager` and `HttpProjectConfigManager`.
7071

7172
These are optional plug-ins and default behavior is implement if none are provided.
7273

74+
#### OptimizelyFactory
75+
76+
[`OptimizelyFactory`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/OptimizelyFactory.cs)
77+
provides basic utility to instantiate the Optimizely SDK with a minimal number of configuration options.
78+
79+
`OptimizelyFactory` does not capture all configuration and initialization options. For more use cases,
80+
build the resources via their respective builder classes.
81+
82+
##### Use OptimizelyFactory
83+
84+
You must provide the SDK key at runtime, either directly via the factory method:
85+
```
86+
Optimizely optimizely = OptimizelyFactory.newDefaultInstance(<<SDK_KEY>>);
87+
```
88+
89+
You can also provide default datafile with the SDK key.
90+
```
91+
Optimizely optimizely = OptimizelyFactory.newDefaultInstance(<<SDK_KEY>>, <<Fallback>>);
92+
```
93+
94+
#### HttpProjectConfigManager
95+
96+
[`HttpProjectConfigManager`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/Config/HttpProjectConfigManager.cs)
97+
is an implementation of the abstract [`PollingProjectConfigManager`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/Config/PollingProjectConfigManager.cs).
98+
The `Poll` method is extended and makes an HTTP GET request to the configured URL to asynchronously download the
99+
project datafile and initialize an instance of the ProjectConfig.
100+
101+
By default, `HttpProjectConfigManager` will block until the first successful datafile retrieval, up to a configurable timeout.
102+
Set the frequency of the polling method and the blocking timeout with `HttpProjectConfigManager.Builder`.
103+
104+
##### Use HttpProjectConfigManager
105+
106+
```
107+
HttpProjectConfigManager httpManager = new HttpProjectConfigManager.Builder()
108+
.WithSdkKey(sdkKey)
109+
.WithPollingInterval(TimeSpan.FromMinutes(1))
110+
.Build();
111+
```
112+
113+
##### SDK key
114+
115+
The SDK key is used to compose the outbound HTTP request to the default datafile location on the Optimizely CDN.
116+
117+
##### Polling interval
118+
119+
The polling interval is used to specify a fixed delay between consecutive HTTP requests for the datafile. Between 1 to 4294967294 miliseconds is valid duration. Otherwise default 5 minutes will be used.
120+
121+
##### Blocking Timeout Period
122+
123+
The blocking timeout period is used to specify a maximum time to wait for initial bootstrapping. Between 1 to 4294967294 miliseconds is valid blocking timeout period. Otherwise default value 15 seconds will be used.
124+
125+
##### Initial datafile
126+
127+
You can provide an initial datafile via the builder to bootstrap the `ProjectConfigManager` so that it can be used immediately without blocking execution.
128+
129+
##### URL
130+
131+
The URL is used to specify the location of datafile.
132+
133+
##### Format
134+
135+
This option enables user to provide a custom URL format to fetch the datafile.
136+
137+
##### Start by default
138+
139+
This option is used to specify whether to start the config manager on initialization.
140+
73141
## Development
74142

75143
### Unit tests

0 commit comments

Comments
 (0)