Skip to content

Commit 0e830b1

Browse files
author
manpreet.singh
committed
Added unit test for SSE entity
2 parents d96cada + c4dbc87 commit 0e830b1

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# apache-sseclient
1+
# apache-sseclient
2+
3+
This is a wrapper around the Apache HTTP components async client to listen for and process [Server-Sent Events](https://www.w3.org/TR/eventsource/).
4+
5+
### Usage
6+
7+
Create an instance of the async client & start it.
8+
```
9+
CloseableHttpAsyncClient asyncClient = HttpAsyncClients.createDefault();
10+
asyncClient.start();
11+
```
12+
13+
Create the request.
14+
```
15+
SseRequest request = new SseRequest(YOUR_REQUEST_URI);
16+
```
17+
18+
Create the SSE client instance and provice `ExecutorService` instance to run the requests in a new thread.
19+
```
20+
ApacheHttpSseClient sseClient = new ApacheHttpSseClient(asyncClient, Executors.newFixedThreadPool(CONCURRENT_SSE_STREAMS));
21+
```
22+
23+
Execute the request and get the `Future` response instance.
24+
```
25+
Future<SseResponse> sseResponse = sseClient.execute(request);
26+
```
27+
28+
### Authors
29+
30+
Created by [@ytoh](https://github.com/ytoh) & [@manpreet333](https://github.com/manpreet333) when in the middle of a project we realized Apache client doesn't have this functionality.

0 commit comments

Comments
 (0)