Skip to content

Commit 55f9815

Browse files
authored
Updating readme (#3)
* Adding custom Http implementation info * Info about AsyncHttpClient
1 parent 4513b29 commit 55f9815

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
```
2828

2929
*Note: The SDK uses a standard interface for the http backend see [HttpClient.](https://github.com/evolv-ai/ascend-java-sdk/blob/master/src/main/java/ai/evolv/HttpClient.java).
30-
When configuring the client you must specify what implementation of HttpClient to use (or implement your own).*
30+
When configuring the client you must specify what implementation of HttpClient to use (or implement your own). See "Custom Http Backend" for more details.*
3131

3232
2. Initialize the AscendClient.
3333
```java
@@ -70,12 +70,12 @@ subscribe to a value and apply any actions as a result of it asynchronously.
7070
requested value, the default value will be returned in its place. If you have a previous allocation stored the
7171
value will be retrieved and then your code will be executed. When the new allocation is retrieved if the value
7272
differs from the previously stored allocation then your code will be ran again with the new value. If your code
73-
results in an Exception it will be thrown.*
73+
results in an Exception it will be logged but no runtime exception is thrown.*
7474

7575
### Custom Events (optional)
7676

7777
Sometimes you may want to record certain events that occurred during the participant's session. An example of an event
78-
thats important to record is a "conversion" event. If you implemented the SDK in a shopping app, you could send the
78+
that is important to record is a "conversion" event. If you implemented the SDK in a shopping app, you could send the
7979
"conversion" event when the participant presses the checkout button.
8080

8181
1. Emit a custom event.
@@ -99,6 +99,23 @@ Sometimes it may be necessary to contaminate the participant's allocation. Meani
9999
client.contaminate();
100100
```
101101

102+
103+
### Custom Http Backend
104+
105+
The Ascend Client uses a standard Http interface for making Http requests to the Participant API, see [HttpClient.](https://github.com/evolv-ai/ascend-java-sdk/blob/master/src/main/java/ai/evolv/HttpClient.java)
106+
We have built a couple of implementations that are available out of the box, you can also feel free to create your own. At initialization you will need to pass in the HttpClient that you want to use to the
107+
AscendConfig class.
108+
109+
1. Choose an HttpClient and pass it to the AscendConfig.
110+
111+
```java
112+
HttpClient httpClient = new AsyncHttpClientImpl(<request_timeout>);
113+
AscendConfig config = AscendConfig.builder(<environment_id>, httpClient).build();
114+
AscendClient client = AscendClientFactory.init(config);
115+
```
116+
*Note: The above HttpClient implementation uses org.asynchttpclient:async-http-client as its http client. In order to use
117+
the implementation you will need to bring the package into your dependencies.*
118+
102119
### Custom Allocation Store (optional)
103120

104121
Once a participant has been allocated into an experiment you may want to retain the allocations they received. To do this, create a custom allocation store by implementing the AscendAllocationStore interface. You can supply the

0 commit comments

Comments
 (0)