You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by walter <in...@gmail.com> on 2011/03/07 22:58:44 UTC

Replace Web Services with Message

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.

Re: Replace Web Services with Message

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

also take a look at:

http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html
http://camel.apache.org/request-reply.html


Regards
-- 
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dejanb@fusesource.com
Web: http://fusesource.com
Twitter:  http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Mar 8, 2011 at 8:12 AM, Christian Schneider <chris@die-schneider.net
> wrote:

> 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
>
>

Re: Replace Web Services with Message

Posted by Christian Schneider <ch...@die-schneider.net>.
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