Skip to content

readme: Updated Readme #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,77 @@ The Optimizely client object accepts the following plug-ins:
1. `IEventDispatcher` handles the HTTP requests to Optimizely. The default implementation is an asynchronous "fire and forget".
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.
3. `IErrorHandler` allows you to implement custom logic when Exceptions are thrown. Note that Exception information is already included in the Log.
4. `ProjectConfigManager` exposes method for retrieving ProjectConfig instance. Examples include `FallbackProjectConfigManager` and `HttpProjectConfigManager`.

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

#### OptimizelyFactory

[`OptimizelyFactory`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/OptimizelyFactory.cs)
provides basic utility to instantiate the Optimizely SDK with a minimal number of configuration options.

`OptimizelyFactory` does not capture all configuration and initialization options. For more use cases,
build the resources via their respective builder classes.

##### Use OptimizelyFactory

You must provide the SDK key at runtime, either directly via the factory method:
```
Optimizely optimizely = OptimizelyFactory.newDefaultInstance(<<SDK_KEY>>);
```

You can also provide default datafile with the SDK key.
```
Optimizely optimizely = OptimizelyFactory.newDefaultInstance(<<SDK_KEY>>, <<Fallback>>);
```

#### HttpProjectConfigManager

[`HttpProjectConfigManager`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/Config/HttpProjectConfigManager.cs)
is an implementation of the abstract [`PollingProjectConfigManager`](https://github.com/optimizely/csharp-sdk/blob/master/OptimizelySDK/Config/PollingProjectConfigManager.cs).
The `Poll` method is extended and makes an HTTP GET request to the configured URL to asynchronously download the
project datafile and initialize an instance of the ProjectConfig.

By default, `HttpProjectConfigManager` will block until the first successful datafile retrieval, up to a configurable timeout.
Set the frequency of the polling method and the blocking timeout with `HttpProjectConfigManager.Builder`.

##### Use HttpProjectConfigManager

```
HttpProjectConfigManager httpManager = new HttpProjectConfigManager.Builder()
.WithSdkKey(sdkKey)
.WithPollingInterval(TimeSpan.FromMinutes(1))
.Build();
```

##### SDK key

The SDK key is used to compose the outbound HTTP request to the default datafile location on the Optimizely CDN.

##### Polling interval
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the min and max for both these values as stated in PR #172


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.

##### Blocking Timeout Period

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.

##### Initial datafile

You can provide an initial datafile via the builder to bootstrap the `ProjectConfigManager` so that it can be used immediately without blocking execution.

##### URL

The URL is used to specify the location of datafile.

##### Format

This option enables user to provide a custom URL format to fetch the datafile.

##### Start by default

This option is used to specify whether to start the config manager on initialization.

## Development

### Unit tests
Expand Down