Hi,
implementing services using queues works quite well. As always you have
several options.
First thing is that you have to decide which message format you want.
Dependending on the format you have several options:
- SOAP : You can use a webservices framework with support for SOAP/JMS.
For example CXF or Axis2
- XML, Java Serialization : You can either do this by hand, using spring
jms abstractions or Apache Camel
Generally all of the options send back a message using the replyTo
message header. You set this header to a queue where you expect the
reply. Most times you will use a temporary queue for this. The client
creates a temporary queue, sets it as reply to, sends the message and
listens for replies on the temp queue.
As this is not the easiest thing to do by hand I suggest you take a look
at Apache Camel first. Chances are high it solves your problem very easily.
For example you can use a camel producertemplate on the client side:
MyResponse resonse = producerTemplate.requestBody("jms:myQueue", myRequest);
On the server side the easiest way to go is to use:
class MyServerClass {
@Consume("jms:myQueue")
public MyResponse handleRequest(MyRequest myRequest) {
}
}
This is almost all you need to for request reply processing with jms,
temporary reply queues and java serialization.
Christian
Am 07.03.2011 22:58, schrieb walter:
I am exploring the possibility to replace one of our Web Services
implementation with message queues. Conceptually clients will be connected
to the server with “Network of Brokers” as follow:
Many Clients (broker)<--> (broker) Server
with duplex = 'true'. The clients will put messages to a queue consumed by
the server. Is this a viable solution and what is a workable way to pass
the messages from the server back to the appropriate client?
--
View this message in context:
http://activemq.2283324.n4.nabble.com/Replace-Web-Services-with-Message-tp3340103p3340103.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
--
----
http://www.liquid-reality.de