Reputation: 961
I have created a RESTful service using JAX-RS Jersey and deployed it on a tomcat 7 server.
Now I would like to use JMS. The request would be captured and directed to a message queue on a message broker and from there messages should be pushed towards the REST service and then the response would be redirected to the end user.
I am using Activemq. How can I integrate Activemq with a RESTful service?
Upvotes: 3
Views: 779
Reputation: 12998
Your webservice interface needs to offer two functions: submit
and poll
.
submit
which in turn sends the request as a JMS message on the incoming queue, and returns the message ID. submit
returns after that.poll
function with the message ID (as returned by submit
) as an argument: poll
checks the result queue using a JMS message selector on the correlation ID. It returns "not yet completed" or the result. The client possibly needs to call poll
multiple times to get the result.Notes:
Upvotes: 3