You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jrpedersen <jr...@gmail.com> on 2013/03/07 15:42:01 UTC
How to get response from activeMQ when a message is put on queue?
Hi,
I am trying to use Camel (mina, jms) where I receive messages on a tcp port,
using mina, and decode the message before it is put on a activemq queue.
I want to send a ack on tcp if the message is succesfully added to the queue
or a nack if not.
use this route:
<route id=receiver1>
<from
uri=mina:tcp//localhost:6000?textline=false&sync=true&codec=#myCodec"
/>
<to uri="jms:myQueue">
</route>
This gives org.apache.camel.ExchangeTimedOutException: The OUT message was
not received within: 20000 milli...
How should I get jms to send a answer that the mesage is sucessfully qued?
br
JR
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to get response from activeMQ when a message is put on
queue?
Posted by jrpedersen <jr...@gmail.com>.
Thank you for your replies.
I changed the route to:
<route id=receiver1>
<from
uri=mina:tcp//localhost:6000?textline=false&sync=true&codec=#myCodec"
/>
<inOnly uri="jms:myQueue">
<setBody>
<constant>OkSendAck</constant>
</setBody>
</route>
And that solved the problem. If my encoder receives "OkSendAck" it will send
ack if receives a exception or anything else it will send NACK (or close the
tcp session)
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765p5728940.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to get response from activeMQ when a message is put on queue?
Posted by Christian Müller <ch...@gmail.com>.
Try
<route id=receiver1>
<from
uri=mina:tcp//localhost:6000?textline=false&sync=true&codec=#myCodec"
/>
<inOnly uri="jms:myQueue">
</route>
Best,
Christian
On Thu, Mar 7, 2013 at 3:42 PM, jrpedersen <jr...@gmail.com> wrote:
> Hi,
> I am trying to use Camel (mina, jms) where I receive messages on a tcp
> port,
> using mina, and decode the message before it is put on a activemq queue.
> I want to send a ack on tcp if the message is succesfully added to the
> queue
> or a nack if not.
>
> use this route:
>
> <route id=receiver1>
> <from
>
> uri=mina:tcp//localhost:6000?textline=false&sync=true&codec=#myCodec"
> />
> <to uri="jms:myQueue">
> </route>
>
> This gives org.apache.camel.ExchangeTimedOutException: The OUT message was
> not received within: 20000 milli...
>
> How should I get jms to send a answer that the mesage is sucessfully qued?
>
> br
> JR
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Re: How to get response from activeMQ when a message is put on queue?
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 7, 2013 at 3:42 PM, jrpedersen <jr...@gmail.com> wrote:
> Hi,
> I am trying to use Camel (mina, jms) where I receive messages on a tcp port,
> using mina, and decode the message before it is put on a activemq queue.
> I want to send a ack on tcp if the message is succesfully added to the queue
> or a nack if not.
>
> use this route:
>
> <route id=receiver1>
> <from
> uri=mina:tcp//localhost:6000?textline=false&sync=true&codec=#myCodec"
> />
> <to uri="jms:myQueue">
> </route>
>
> This gives org.apache.camel.ExchangeTimedOutException: The OUT message was
> not received within: 20000 milli...
>
> How should I get jms to send a answer that the mesage is sucessfully qued?
>
If you want to only send the message on the queue in a fire and forget
fashion (eg InOnly) then read about the event message EIP pattern
http://camel.apache.org/event-message.html
What you current have is request-reply, because you have configured
the mina endpoint to be sync=true.
http://camel.apache.org/request-reply.html
> br
> JR
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: How to get response from activeMQ when a message is put on
queue?
Posted by ODarwish <ot...@progressoft.com>.
dont forget to add handled=true onexception block
-----
Othman Darwish
ProgressSoft Corp.
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765p5728767.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to get response from activeMQ when a message is put on
queue?
Posted by ODarwish <ot...@progressoft.com>.
hi
you can add exception handler on route or context scope to send the nac
reply , as for ack after sending the jms you can create the ack message and
post it to tcp point
e.g .
from direct
{onexception
create nak response ,attach it to exchange body
to tcp
}
to jms
ceate ack response and attach it to exchange body
to tcp
-----
Othman Darwish
ProgressSoft Corp.
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-get-response-from-activeMQ-when-a-message-is-put-on-queue-tp5728765p5728766.html
Sent from the Camel - Users mailing list archive at Nabble.com.