Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support an asynchronous API for RestTemplate [SPR-8804] #13446

Closed
spring-projects-issues opened this issue Oct 26, 2011 · 9 comments
Closed

Support an asynchronous API for RestTemplate [SPR-8804] #13446

spring-projects-issues opened this issue Oct 26, 2011 · 9 comments
Assignees
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 26, 2011

Mike Youngstrom opened SPR-8804 and commented

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.


Referenced from: commits 296e218, ebcee26, 20c4177, 38c8c6d

12 votes, 19 watchers

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented 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
Copy link
Collaborator Author

spring-projects-issues commented 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

Future result1 = execute(...);
Future result2 = execute(...);
Future result3 = execute(...);

merge(result1, result2, result3);

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 8, 2012

Chris Beams commented

Added @Rossen as a watcher as well as he's currently investigating async options in 3.2

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 3, 2012

Lukas Krecan commented

I have written a quick prototype of AsyncRestTemplate lukas-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.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented 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
Copy link
Collaborator Author

spring-projects-issues commented Apr 22, 2013

Lukas Krecan commented

Do you have any update whether it will make it to Spring 4?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 4, 2013

Arjen Poutsma commented

It will make it :).

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Aug 15, 2013

Arjen Poutsma commented

Pull request at #336

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented 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

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0 M3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants