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
{{ message }}
Repository navigation
Support an asynchronous API for RestTemplate [SPR-8804] #13446
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: coreIssues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement
Asynchronous programming models are growing in popularity. To support this model of development it would be great if RestTemplate were enhanced to support an asynchronous model.
JAX-RS's client api is currently slated to add an asynchronous mode.
There are several Async Http client libraries.
It would seem that soon would be the right time to add Async support for RestTemplate.
Thanks for the submission, Mike. I've added Juergen, Arjen and others as watchers on this issue and slated it for the 3.2 backlog. Agreed that 3.2 is likely the right time to consider such functionality; I'll be interested to see what other users have to say about this as well. Use cases would be helpful to ensure we're all on the same page.
We have similar need. Our use case is simple. We are creating an aggregated resource. We need to call several underlying REST APIs and when all of the results return, we merge them to return aggregated result. We want to execute all the requests in parallel. So the ideal API would be
I have written a quick prototype of AsyncRestTemplatelukas-krecan@1f55c1b. Basically it wraps RestTemplate, executes the corresponding method using AsyncTaskExecutor and returns Future instead of the original return value. Please let me know what you think about it. If you are interested, I will fix the documentation, formating, tests and other stuff and will issue a pull request.
Yes, that will certainly be one part of the implementation. We'll also want to support HTTP libraries that provide non-blocking support like Appache HttpComponents HttpAsyncClient.
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: coreIssues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement
Activity
spring-projects-issues commentedon Nov 1, 2011
Chris Beams commented
Thanks for the submission, Mike. I've added Juergen, Arjen and others as watchers on this issue and slated it for the 3.2 backlog. Agreed that 3.2 is likely the right time to consider such functionality; I'll be interested to see what other users have to say about this as well. Use cases would be helpful to ensure we're all on the same page.
spring-projects-issues commentedon Mar 8, 2012
Lukas Krecan commented
We have similar need. Our use case is simple. We are creating an aggregated resource. We need to call several underlying REST APIs and when all of the results return, we merge them to return aggregated result. We want to execute all the requests in parallel. So the ideal API would be
spring-projects-issues commentedon Mar 8, 2012
Chris Beams commented
Added
@Rossenas a watcher as well as he's currently investigating async options in 3.2spring-projects-issues commentedon Oct 3, 2012
Lukas Krecan commented
I have written a quick prototype of
AsyncRestTemplatelukas-krecan@1f55c1b. Basically it wrapsRestTemplate, executes the corresponding method usingAsyncTaskExecutorand returns Future instead of the original return value. Please let me know what you think about it. If you are interested, I will fix the documentation, formating, tests and other stuff and will issue a pull request.spring-projects-issues commentedon Oct 4, 2012
Rossen Stoyanchev commented
Yes, that will certainly be one part of the implementation. We'll also want to support HTTP libraries that provide non-blocking support like Appache HttpComponents HttpAsyncClient.
spring-projects-issues commentedon Apr 22, 2013
Lukas Krecan commented
Do you have any update whether it will make it to Spring 4?
spring-projects-issues commentedon Jul 4, 2013
Arjen Poutsma commented
It will make it :).
spring-projects-issues commentedon Aug 15, 2013
Arjen Poutsma commented
Pull request at #336
spring-projects-issues commentedon Oct 15, 2013
Luciano Leggieri commented
Do you think it's worth to add support for https://github.com/AsyncHttpClient/async-http-client ? It's a popular framework for non-blocking connections.
I have a first draft here: https://github.com/lukiano/async-http-client-spring