You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jonasty <jo...@gmail.com> on 2015/05/19 14:57:15 UTC

How to wiretap without consuming the original queue

Hello
I am monitoring activemq, I use following routebuilder for this:

@Override
    public void configure() throws Exception {
        from("activemq:queue:aap").wireTap("activemq:queue:aapTap");
       
from("activemq:queue:aapTap").process(myProcessor).id("QueueIncoming");
    }

But when I send manual messages to the queue, they get to the tap queue and
get consumed on the wireTap, which is ok but also on the original queue,
which is NOT ok

How can I solve this?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

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

ActiveMQ has functionality to do "wire tapping" out of the box with
mirrored queues and composite destinations and whatnot. So you may
want to take a look at that and then you don't need Camel for
wiretapping.



On Wed, May 20, 2015 at 11:00 AM, Jonasty <jo...@gmail.com> wrote:
> But how can I log in that case a new incoming message on the queue?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767305.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: How to wiretap without consuming the original queue

Posted by yogu13 <yo...@gmail.com>.
try exploring JMS Selector for filtering out http://camel.apache.org/jms.html

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767316.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Pontus Ullgren <ul...@gmail.com>.
For your use case camel is not the right tool. The camel jms component will
be a consumer consuming messages from the queue and process them as camle
exchanges.

The camel wiretap is for wiretapping camel exchanges in a camel route to
some other endpoint.

Take Claus advice and look at the features avail in activemq.

Best regards
Pontus Ullgren

On Wed, 20 May 2015 14:37 Jonasty <jo...@gmail.com> wrote:

> The only helpful are questions that I posted by myself...
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767324.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
The only helpful are questions that I posted by myself...



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767324.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

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

I suggest to search/google for "how to monitor activemq"


On Wed, May 20, 2015 at 1:21 PM, Jonasty <jo...@gmail.com> wrote:
> Thanks, but Camel isn't allowed to consume in my program. I just need to
> monitor the queue.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767318.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
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
Thanks, but Camel isn't allowed to consume in my program. I just need to
monitor the queue.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767318.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Reji Mathews <co...@gmail.com>.
How about Queue peek operation via JMX?

Cheers
Reji

On Wed, May 20, 2015 at 4:38 PM, Henryk Konsek <he...@gmail.com> wrote:

> Hi,
>
> In general Camel can't consume message and not remove it from the queue at
> the same time, as it relies on the ActiveMQ client which... consumes the
> messages. :)
>
> You can consider using ActiveMQ mirrored queues and use Camel to consume
> only the copy of the message flow.
>
> Cheers.
>
> śr., 20.05.2015 o 12:49 użytkownik Jonasty <jo...@gmail.com>
> napisał:
>
> > If I do that, I wel get an unclosable loop of messages being pumped at
> the
> > same queue.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767315.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>

Re: How to wiretap without consuming the original queue

Posted by Henryk Konsek <he...@gmail.com>.
Hi,

In general Camel can't consume message and not remove it from the queue at
the same time, as it relies on the ActiveMQ client which... consumes the
messages. :)

You can consider using ActiveMQ mirrored queues and use Camel to consume
only the copy of the message flow.

Cheers.

śr., 20.05.2015 o 12:49 użytkownik Jonasty <jo...@gmail.com>
napisał:

> If I do that, I wel get an unclosable loop of messages being pumped at the
> same queue.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767315.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
If I do that, I wel get an unclosable loop of messages being pumped at the
same queue.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767315.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by yogu13 <yo...@gmail.com>.
You can either use what Claus mentioned which is already part of activemq or

from("activemq:queue:aap")
    .wireTap("direct:log") 
    .to("activemq:queue:aap") // instead of processing adding back to queue



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767312.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
I don't want to process anything, this is not the function of my program

So I get 

from("activemq:queue:aap").wireTap("direct:log") 

// this is the tapped route 
from("direct:log").process(myProcessor)



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767310.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by yogu13 <yo...@gmail.com>.
Assuming aap queue is the source and the place where messages landup which
you would like to log and forward it for processing then my route would be 

from("activemq:queue:aap")
    .wireTap("direct:log")
    .to("direct:processRequest")

// this is the tapped route
from("direct:log")
    ..... // code for appropriate logging needed

//original message
from("direct:processRequest")
  .... // code for processing the request

More info with examples @ http://camel.apache.org/wire-tap.html

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767308.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
But how can I log in that case a new incoming message on the queue?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767305.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by yogu13 <yo...@gmail.com>.
Ok Got you now! The activemq consumer component i.e
'from("activemq:queue:aap")' is going to consume the message and create it
into an exchange with your wiretap call its going to drop a copy of that
exchange to your aapTap queue. The original message isnt being used for
anything. The situation is best described in below diagram


<http://camel.465427.n5.nabble.com/file/n5767302/WireTap.gif> 

So here if you want the message back in aap queue .. you will have to write
a producer which pushes the message back to the queue.

Hope this helps!



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767302.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
That's the whole point, I am wiretapping it, but it still get polled from my
queue,

My routes look like:
from("activemq:queue:" +
propertiesManager.getProperty("queueName")).wireTap("activemq:queue:" +
propertiesManager.getProperty("queueName") + "Tap");
        from("activemq:queue:" + propertiesManager.getProperty("queueName")
+ "Tap").process(processor).id("QueueIncoming");



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767300.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by yogu13 <yo...@gmail.com>.
Hello,

would it help if on consuming the message (for processing ) you wiretap it
(push it to db)?

I am assuming that you want that message to stay on the queue so that
someone can process it.

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767298.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
I am trying to monitor a queue on a public activeMQ server
For every incoming message, I need this wiretap to process it (pumping a
record into a database). Because a Queue has 1 producer and 1 consumer, but
I want to let the message stay on his queue and not poll it.
That's why I just want to wiretap this incoming messages.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767296.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Henryk Konsek <he...@gmail.com>.
Sorry for answering with the question, but what is purpose of sending the
message to the wireTap and then to nowhere? :) I'm trying to understand
what you try to achieve here.

Cheers!

wt., 19.05.2015 o 15:48 użytkownik Jonasty <jo...@gmail.com>
napisał:

> How can I send it to nowhere or do nothing?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767255.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How to wiretap without consuming the original queue

Posted by Jonasty <jo...@gmail.com>.
How can I send it to nowhere or do nothing?



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253p5767255.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to wiretap without consuming the original queue

Posted by Henryk Konsek <he...@gmail.com>.
Hi,

You should add some destination after the wireTap. For example:

    from("activemq:queue:aap").wireTap("activemq:queue:aapTap").to(...);

Then you will see that the original flow is processed regardless of the
wireTap flow.

Cheers!

wt., 19.05.2015 o 14:57 użytkownik Jonasty <jo...@gmail.com>
napisał:

> Hello
> I am monitoring activemq, I use following routebuilder for this:
>
> @Override
>     public void configure() throws Exception {
>         from("activemq:queue:aap").wireTap("activemq:queue:aapTap");
>
> from("activemq:queue:aapTap").process(myProcessor).id("QueueIncoming");
>     }
>
> But when I send manual messages to the queue, they get to the tap queue and
> get consumed on the wireTap, which is ok but also on the original queue,
> which is NOT ok
>
> How can I solve this?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-wiretap-without-consuming-the-original-queue-tp5767253.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>