-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Description
I am trying to get my head around why my code does not work when I try to use an async client (Apache) while the JDK works fine.
My use case is connecting to the Twitter stream endpoint. There's already such a client and it doesn't work with an async client (https://github.com/redouane59/twittered) either.
With the default JDK client, all is fine. With the Apache one, the callback is never invoked (neither the onCompleted
or the onError
). However, if I enable the logging of the client, I can see the connection is established and the stream is being consumed.
Example usage with Twittered:
ApacheHttpClient httpClient = new ApacheHttpClient(HttpAsyncClientBuilder.create()
.setDefaultRequestConfig(RequestConfig.custom()
.setCookieSpec(CookieSpecs.STANDARD)
.setSocketTimeout((int) Duration.ofSeconds(30).toMillis()).build()));
TwitterClient twitterClient = new TwitterClient(credentials, httpClient);
System.out.println("Initiate stream");
twitterClient.startFilteredStream((tweet) -> System.out.println(tweet.getText()));
If I use the default (JDK) client, the callback is invoked.
zorrobiwan
Metadata
Metadata
Assignees
Labels
No labels