apache-httpasyncclient

How does HttpAsyncClient 4 work?

纵然是瞬间 提交于 2020-08-24 06:58:11
问题 In previous versions of HttpClient target host was set up into client itself. In last version (for HttpAsyncClient it's 4.1.1) host is set up into HttpRequest ( HttpGet , HttpPost etc.) every time I do a request. I want to use persistent connection, so I use HttpAsyncClient . I create and use it like this: CloseableHttpAsyncClient client = HttpAsyncClients.createDefault(); client.start(); List<Future<HttpResponse>> responses = new ArrayList<>(); for (int i = 0; i < 10; i++) { HttpGet get =

How does HttpAsyncClient 4 work?

我的未来我决定 提交于 2020-08-24 06:57:59
问题 In previous versions of HttpClient target host was set up into client itself. In last version (for HttpAsyncClient it's 4.1.1) host is set up into HttpRequest ( HttpGet , HttpPost etc.) every time I do a request. I want to use persistent connection, so I use HttpAsyncClient . I create and use it like this: CloseableHttpAsyncClient client = HttpAsyncClients.createDefault(); client.start(); List<Future<HttpResponse>> responses = new ArrayList<>(); for (int i = 0; i < 10; i++) { HttpGet get =

java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED

社会主义新天地 提交于 2020-01-01 04:19:07
问题 I have a service that is expected to execute requests at ~5 or more requests/min. This service depends on Apache AsyncHttpClient. After every few minutes, the clients hits some condition which causes java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED . All requests to the client start failing with same exception message. After service is restarted, this cycle repeats. It is really hard to debug this problem as the request execution failure surprisingly

ElasticSearch and Apache HttpAsyncClient

坚强是说给别人听的谎言 提交于 2019-12-12 15:16:27
问题 I'm trying to use ElasticSearch REST API with Java Apache HttpAsyncClient library. I want to use persistent pipelining connection. Here is some test code (output is in comments): @Test public void testEsPipeliningClient() throws IOException, ExecutionException, InterruptedException { testPost(HttpAsyncClients.createDefault()); //201: {"_index":"test_index","_type":"test_type","_id":"AVIHYGnqdqqg_TAHm4ix","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true} testPost

Async response streaming with Apache Async Http client

无人久伴 提交于 2019-12-11 05:45:22
问题 I am using apache async http client to stream objects from azure storage. I only need to return the HttpResponse object which has the stream associated. My clients will actually have to read from that stream to store the file locally. So Apache Async clients use a BasicAsyncResponseConsumer which actually buffers the entire file in local memory before calling the completed callback. I am trying to create my own implementation of AbstractAsyncResponseConsumer so that I can stream the response

java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED

三世轮回 提交于 2019-12-03 10:59:08
I have a service that is expected to execute requests at ~5 or more requests/min. This service depends on Apache AsyncHttpClient. After every few minutes, the clients hits some condition which causes java.lang.IllegalStateException: Request cannot be executed; I/O reactor status: STOPPED . All requests to the client start failing with same exception message. After service is restarted, this cycle repeats. It is really hard to debug this problem as the request execution failure surprisingly does not cause a callback to the failed() method of the AsyncResponse. From what I could gather, there