You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by LeBro <tz...@gmx.de> on 2016/07/08 10:16:29 UTC

Activemq-cpp request-response

I started to work with Activemq-cpp and used the asychronous client that is
available as example. But now I want to implement a request-response, i.e.
the producer starts SENDINGa message to the consumer and WAITS for the
response. The consumer GETS the message, CHANGES it and SENDS back to the
producer. The consumer has a receive option, but I have no idea how to
configure both for request-response, especially the producer.

I appriciate any help. Thx in advance.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Activemq-cpp-request-response-tp4713776.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Activemq-cpp request-response

Posted by LeBro <tz...@gmx.de>.
Simple answer, deactivate nummessages.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Activemq-cpp-request-response-tp4713776p4713851.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Activemq-cpp request-response

Posted by LeBro <tz...@gmx.de>.
It works. Thank you. 

Now there is another question: How to set up a consumer waiting forever? The
timelimit can be set by waitmillis=-1, but what about deactivating the
shutdown after a predefined number of messages? 

Thanks in advance.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Activemq-cpp-request-response-tp4713776p4713809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Activemq-cpp request-response

Posted by Timothy Bish <ta...@gmail.com>.
On 07/08/2016 06:16 AM, LeBro wrote:
> I started to work with Activemq-cpp and used the asychronous client that is
> available as example. But now I want to implement a request-response, i.e.
> the producer starts SENDINGa message to the consumer and WAITS for the
> response. The consumer GETS the message, CHANGES it and SENDS back to the
> producer. The consumer has a receive option, but I have no idea how to
> configure both for request-response, especially the producer.
>
> I appriciate any help. Thx in advance.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Activemq-cpp-request-response-tp4713776.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

The CMS client is a porting of JMS to C++ and as such the examples 
<http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html> 
that explain how to do JMS Request / Response are easy to port to the 
C++ client.

The basic structure is that on the request side the client must create a 
producer to send the request and a consumer to process the response. The 
consumer should be created and be listening on the target response 
destination prior to sending the request. On the responder side a 
consumer is created that reads from the request Queue and does its work 
and when done it creates a producer that sends a response to the 
destination specified in the ReplyTo property of the incoming request.


-- 
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/