You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to lack of time on my end and this repo being dead for most of the last couple of years, I am bringing the repo back up for maintenance. Reach out to me on Twitter - @TomGranot - for more info.
Follow [@AsyncHttpClient](https://twitter.com/AsyncHttpClient) on Twitter.
@@ -13,7 +9,8 @@ It's built on top of [Netty](https://github.com/netty/netty). It's currently com
13
9
14
10
## New Roadmap RFCs!
15
11
16
-
Well, not really RFCs, but as [I](https://github.com/TomGranot) am ramping up to release a new version, I would appreciate the comments from the community. Please add an issue and [label it RFC](https://github.com/AsyncHttpClient/async-http-client/labels/RFC) and I'll take a look!
12
+
Well, not really RFCs, but as [I](https://github.com/TomGranot) am ramping up to release a new version, I would appreciate the comments from the community. Please add an issue
13
+
and [label it RFC](https://github.com/AsyncHttpClient/async-http-client/labels/RFC) and I'll take a look!
17
14
18
15
## Installation
19
16
@@ -22,6 +19,7 @@ Binaries are deployed on Maven Central.
22
19
Import the AsyncHttpClient Bill of Materials (BOM) to add dependency management for AsyncHttpClient artifacts to your project:
23
20
24
21
```xml
22
+
25
23
<dependencyManagement>
26
24
<dependencies>
27
25
<dependency>
@@ -35,13 +33,14 @@ Import the AsyncHttpClient Bill of Materials (BOM) to add dependency management
35
33
</dependencyManagement>
36
34
```
37
35
38
-
Add a dependency on the main AsyncHttpClient artifact:
36
+
Add a dependency on the main AsyncHttpClient artifact:
AsyncHttpClient instances must be closed (call the `close` method) once you're done with them, typically when shutting down your application.
82
81
If you don't, you'll experience threads hanging and resource leaks.
83
82
84
83
AsyncHttpClient instances are intended to be global resources that share the same lifecycle as the application.
85
84
Typically, AHC will usually underperform if you create a new client for each request, as it will create new threads and connection pools for each.
86
-
It's possible to create shared resources (EventLoop and Timer) beforehand and pass them to multiple client instances in the config. You'll then be responsible for closing those shared resources.
85
+
It's possible to create shared resources (EventLoop and Timer) beforehand and pass them to multiple client instances in the config. You'll then be responsible for closing
86
+
those shared resources.
87
87
88
88
## Configuration
89
89
@@ -92,7 +92,7 @@ Finally, you can also configure the AsyncHttpClient instance via its AsyncHttpCl
If the `executor` parameter is null, callback will be executed in the IO thread.
@@ -183,7 +185,8 @@ You *MUST NEVER PERFORM BLOCKING* operations in there, typically sending another
183
185
`execute` methods can take an `org.asynchttpclient.AsyncHandler` to be notified on the different events, such as receiving the status, the headers and body chunks.
184
186
When you don't specify one, AHC will use a `org.asynchttpclient.AsyncCompletionHandler`;
185
187
186
-
`AsyncHandler` methods can let you abort processing early (return `AsyncHandler.State.ABORT`) and can let you return a computation result from `onCompleted` that will be used as the Future's result.
188
+
`AsyncHandler` methods can let you abort processing early (return `AsyncHandler.State.ABORT`) and can let you return a computation result from `onCompleted` that will be used
189
+
as the Future's result.
187
190
See `AsyncCompletionHandler` implementation as an example.
188
191
189
192
The below sample just capture the response status and skips processing the response body chunks.
@@ -192,35 +195,36 @@ Note that returning `ABORT` closes the underlying connection.
.thenApply(response->{ /* Do something with the Response */return resp;});
243
+
whenResponse.join(); // wait for completion
240
244
```
241
245
242
-
You may get the complete maven project for this simple demo from [org.asynchttpclient.example](https://github.com/AsyncHttpClient/async-http-client/tree/master/example/src/main/java/org/asynchttpclient/example)
246
+
You may get the complete maven project for this simple demo
247
+
from [org.asynchttpclient.example](https://github.com/AsyncHttpClient/async-http-client/tree/master/example/src/main/java/org/asynchttpclient/example)
243
248
244
249
## WebSocket
245
250
246
251
Async Http Client also supports WebSocket.
247
252
You need to pass a `WebSocketUpgradeHandler` where you would register a `WebSocketListener`.
0 commit comments