You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Cecilio Alvarez <ce...@hotmail.com> on 2013/09/12 08:56:25 UTC

Keep the same message in a queue after consuming it.

Hi,
is possible to consume a message from a queue in ActiveMQ and keep it in the
queue for the next consumption of the same consumer? And is possible to
override a message? I know that is not the goal of Camel and ActiveMQ. But
I'm trying to use INOUT pattern and keep the message for future use.
Something like:
<route>
	<from uri="file://c:/temp/in"/>
	<to uri="activemq:example.A"/>
</route>

<route>
       <from uri="timer...."/>
       <to uri="activemq:example.INOUT" pattern="InOut"/><--here got the
message from example.A
	<to uri="......"/>
</route>

<route>
	<from uri="activemq:example.INOUT"/>
	
	<process ref="consume"/><-----here consume from example.A
</route>


This works, but consume the message. And I would like to keep it in the
queue example.A




--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by Cecilio Alvarez <ce...@hotmail.com>.
The example above will not write the same file again and again, when you set
noop=true camel set idempotent as well. So this line is now:
<pollEnrich
uri="file:c://temp/schedule?noop=true&amp;idempotent=false&amp;fileName=schedule.xml"/><--this
don't consume the file, so I have always the message. 

Hope this help.



--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739255.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by Cecilio Alvarez <ce...@hotmail.com>.
Finally I made it using content enricher,

<route>
        <from uri="file://c:/temp/in"/>
        <to uri="file://c:/temp/schedule"/> <-this override the file, so I
always get the last one.
</route>

<route>
       <from uri="timer...."/>
       <pollEnrich
uri="file:c://temp/schedule?noop=true&amp;fileName=schedule.xml"/><--this
don't consume the file, so I have always the message.
        <to uri="......"/>
</route>

Finally I use file component, because its easier for users to open a simple
xml file to see the message.
Many thanks!




--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739245.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Since you use ActiveMQ you can also try with advisory messages and
then see if that message has some details about last message enqued so
you can use that to see if its the same or new message since last
check.

http://activemq.apache.org/advisory-message.html

On Thu, Sep 12, 2013 at 10:37 AM, Cecilio Alvarez
<ce...@hotmail.com> wrote:
> Thanks for the tips, I will try it!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739235.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Keep the same message in a queue after consuming it.

Posted by Cecilio Alvarez <ce...@hotmail.com>.
Thanks for the tips, I will try it! 



--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739235.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can possible use the browse component and do a poll enrich to grab
the top message (assuming you get the top message)

http://camel.apache.org/content-enricher.html
http://camel.apache.org/browse



On Thu, Sep 12, 2013 at 10:10 AM, Cecilio Alvarez
<ce...@hotmail.com> wrote:
> Exactly that, keep procesing the same message again and again until there's a
> new one. I know sounds strange for camel, but I need to write the same
> message until there's a new version. I tried with file component with let me
> override it. But I need to get the message in a producer.
> Many thanks :)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739230.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Keep the same message in a queue after consuming it.

Posted by Cecilio Alvarez <ce...@hotmail.com>.
Exactly that, keep procesing the same message again and again until there's a
new one. I know sounds strange for camel, but I need to write the same
message until there's a new version. I tried with file component with let me
override it. But I need to get the message in a producer.
Many thanks :)



--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739230.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by James Strachan <ja...@gmail.com>.
I don't really grok what you're trying to do or why ;) Wanna explain it?
You want to keep processing the same message again and again until there's
another one?


On 12 September 2013 08:40, Cecilio Alvarez <ce...@hotmail.com>wrote:

> Thanks for the fast answer.
> I can't send the message back, because that means if I send a new message
> to
> the queue example.A from file, the sent back message will be consume
> before.
> I would like to have something like a LIFO in the queue example.A. And If
> there is no new message, keep consuming the old one. I tried resequencer to
> sort the queue but doesn't seem the way to do it.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739219.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
James
-------
Red Hat

Email: jstracha@redhat.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

Open Source Integration

Re: Keep the same message in a queue after consuming it.

Posted by Cecilio Alvarez <ce...@hotmail.com>.
Thanks for the fast answer.
I can't send the message back, because that means if I send a new message to
the queue example.A from file, the sent back message will be consume before.
I would like to have something like a LIFO in the queue example.A. And If
there is no new message, keep consuming the old one. I tried resequencer to
sort the queue but doesn't seem the way to do it.



--
View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739219.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Keep the same message in a queue after consuming it.

Posted by James Strachan <ja...@gmail.com>.
The way to do this with messaging is either to rollback (to effectively
cancel consuming it) or send the message again


On 12 September 2013 07:56, Cecilio Alvarez <ce...@hotmail.com>wrote:

> Hi,
> is possible to consume a message from a queue in ActiveMQ and keep it in
> the
> queue for the next consumption of the same consumer? And is possible to
> override a message? I know that is not the goal of Camel and ActiveMQ. But
> I'm trying to use INOUT pattern and keep the message for future use.
> Something like:
> <route>
>         <from uri="file://c:/temp/in"/>
>         <to uri="activemq:example.A"/>
> </route>
>
> <route>
>        <from uri="timer...."/>
>        <to uri="activemq:example.INOUT" pattern="InOut"/><--here got the
> message from example.A
>         <to uri="......"/>
> </route>
>
> <route>
>         <from uri="activemq:example.INOUT"/>
>
>         <process ref="consume"/><-----here consume from example.A
> </route>
>
>
> This works, but consume the message. And I would like to keep it in the
> queue example.A
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
James
-------
Red Hat

Email: jstracha@redhat.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

Open Source Integration