SI and multiple clients
I'm looking for a solution of the following use case:
Multiple clients making requests to the server (based on SI components). Because the serverside processing will take some time, the server starts processing (droping the message to a request channel) and returns immediatly with an unique id (correlation id?). Each client will make a second request with the returned id to ask the server for the reply message.
With one client I don't see any problems. But how can the server identify the correct response message with multiple clients?
Are there any concepts in SI?
There are several ways of handling it and yes we already have something like this in SI. If you are familiar with Messaging Gateway if you make several calls to a gateway method and reply messages might come in not necessarily in sequence Gateway has an internal reply correlator.
Also with Spring Integration 2.0 we've introduced an Asynchronous Gateway http://static.springsource.org/sprin...#async-gateway which in the nutshell gives you exactly what you are describing and that is:
1) immediate response (already correlated with the request)
2) ability to wait for a reply
Check it out and let us know if it satisfies your use case.
Thanks Oleg for the fast reply!
Will this also work for http gateways?
Could you provide a little more details regarding your use case. I am trying to understand if you are asking about Inbound or Outbound Http Gateway?
here the use case:
A client makes a HTTP POST request to the server. At server-side there is a HTTP inbound gateway, which creates a message from the request payload and sends the message to a request channel. The HTTP request returns immediately with any kind of identifier. Now there are several processing components like converters, routers and service activators very similar to the cafe sample or your loan broker. In the mean time the client makes HTTP GET requests with the identifier as parameter until the response message will be available.
PS: Sorry for my English.
Well, this is different then what I was proposing earlier.
Let me make sure i understand you correctly first.
You want one HTTP POST request to create a resource and the creation process might take undefined amount of time. So instead of waiting you want to be able to ping the server with the GET request and if the resource available, then get it. Is that correct?
If so, then you can simply establish a contract where the resource identifier (e.g., Message id) generated during the POST request will be the identifier used to store the result of processing (e.g., RDBMS). Then you can use that same returned identifier to build process that checks if the resource is available providing that it will only be available if the first process finished.
Is that what you are looking for?
OK. Are there SI resources who can handle this (maybe something like a MessageStore)?
You mentioned in a comment of INT-852 that you are working on part 2 of your loan broker sample. Are there any news?