I'm trying to do something simple, but can't seem to get it to work. The use case is something like this:
I want to send a quick rest call to trigger an event into a spring route, that event creates a new object and then writes that to a JMS queue (processed by another system in order to separate a long-running process). The created object that is enqueued should then returned to the web service. In this case it's a JMS queue, but it could be any datastore (db, file, email, etc)
Example: (Ignoring the whole REST portion - just looking at the route which is outwired in via the inbound gateway)
Now, this route is obviously wrong because the jms outbound channel adapter doesn't return anything, so the inbound gateway hangs indefinitely. So, what's the 'right' way to do what I'm looking for? Send a message down the route and then get it back once it is successfully persisted at the end of processing.
<int:gateway id="inboundGateway" service-interface="com.readytalk.springInt.endpoint.FooGateway"
<int:channel id="fromFooGateway" />
<int:service-activator input-channel="fromFooGateway" ref="testServiceActivator" method="createObject"
<int:channel id="postCreateChannel" />
<int-jms:outbound-channel-adapter channel="postCreateChannel" destination-name="toProcessQueue"
I know that I could create a service-activator and write to the queue with JmsTemplate, but that seems like a lot of code to do something that the framework can usually handle.
-- Note: This came up as we started looking at error handling using gateways to create 'error segments' as shown by Oleg during one of his spring tips and tricks. Our error handling route was going to write an error message to the database, but that was causing the thread to hang waiting for a reply that was never coming.