Beginner Question about re-routing to a different queue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Beginner Question about re-routing to a different queue

Andreas Guther
Hi, by accident I posted the following the ActiveMQ mailing list but
wanted to ask the question on the Camel User list.  Thanks in advance
for any help.

 

-----Original Message-----

From: Andreas Guther [mailto:[hidden email]]

Sent: Monday, October 08, 2007 4:49 PM

To: [hidden email]

Subject: [Camel] Beginner Question about re-routing to a different queue

 

Hi,

 

I started to look into Apache Camel and I am actually pretty excited
about the different implemented Enterprise Integration Patterns.

 

I looked into the RouteBuilder and experimented with routing messages.

I could get the Spring and the JMS File examples to work and now I have
the idea to route incoming messages from one queue to another one.

 

Somehow I thought I could do something like

 

from("activemq:test.MyQueue").to("activemq:test.MyQueue2");

 

But that gives me a build error:

 

[INFO]

---------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]

---------------------------------------------------------------------

[INFO] null

 

org/apache/commons/pool/ObjectPoolFactory

 

It looks like I am missing some basics here but unfortunately I am not
able to find a solution to this little exercise.

 

Can someone please push me in the right direction?

 

Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Beginner Question about re-routing to a different queue

jstrachan
On 09/10/2007, Andreas Guther <[hidden email]> wrote:
> Hi, by accident I posted the following the ActiveMQ mailing list but
> wanted to ask the question on the Camel User list.  Thanks in advance
> for any help.

[snip]

> I started to look into Apache Camel and I am actually pretty excited
> about the different implemented Enterprise Integration Patterns.

Great! :)

> I looked into the RouteBuilder and experimented with routing messages.
>
> I could get the Spring and the JMS File examples to work and now I have
> the idea to route incoming messages from one queue to another one.
>
> Somehow I thought I could do something like
>
> from("activemq:test.MyQueue").to("activemq:test.MyQueue2");
>
> But that gives me a build error:
>
> [INFO]
> ---------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ---------------------------------------------------------------------
>
> [INFO] null
> org/apache/commons/pool/ObjectPoolFactory
>
> It looks like I am missing some basics here but unfortunately I am not
> able to find a solution to this little exercise.
>
> Can someone please push me in the right direction?


So the code you're using is exactly correct!

In earlier versions of Camel by default we'd use the
PooledConnectionFactory with ActiveMQ; so the exception you're getting
is just that commons-pool is not on the classpath. Our bad for not
making that clear.

FWIW in later versions fo Camel and ActiveMQ; the activemq component
ships with ActiveMQ itself in 5.0 or later; and we've moved from using
the PoolConnectionFactory to using the caching levels in the
MessageListenerContainer in spring to ensure transactional consistency
(so the above takes place in a single JMS transaction).

So when using ActiveMQ 5.0 or later and Camel 1.2 or later you'd not
get the above exception as we'd not be using the
PooledConnectionFactory

--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

RE: Beginner Question about re-routing to a different queue

Andreas Guther
James,

Thank you for your help and solving the problem.

Indeed I was running ActiveMQ 4.1.1 and Camel 1.1.0 yesterday.  I
changed to Camel 1.2.0 but currently have to stay with ActiveMQ 4.1.1. I
added the following dependency to the pom.xml file in the spring example
folder:

<dependency>
      <groupId>commons-pool</groupId>
      <artifactId>commons-pool</artifactId>
      <version>1.3</version>
</dependency>

This allowed me to use the following change in the example router:

from("jms:test.camel.MyQueue").
                to("file://target/test?noop=true",
"jms:test.camel.MyQueue2");


Camel is a really exiting project!  I can't wait to explore more pattern
implementations.

Andreas


-----Original Message-----
From: James Strachan [mailto:[hidden email]]
Sent: Monday, October 08, 2007 10:20 PM
To: [hidden email]
Subject: Re: Beginner Question about re-routing to a different queue

On 09/10/2007, Andreas Guther <[hidden email]> wrote:
> Hi, by accident I posted the following the ActiveMQ mailing list but
> wanted to ask the question on the Camel User list.  Thanks in advance
> for any help.

[snip]

> I started to look into Apache Camel and I am actually pretty excited
> about the different implemented Enterprise Integration Patterns.

Great! :)

> I looked into the RouteBuilder and experimented with routing messages.
>
> I could get the Spring and the JMS File examples to work and now I
have

> the idea to route incoming messages from one queue to another one.
>
> Somehow I thought I could do something like
>
> from("activemq:test.MyQueue").to("activemq:test.MyQueue2");
>
> But that gives me a build error:
>
> [INFO]
> ---------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ---------------------------------------------------------------------
>
> [INFO] null
> org/apache/commons/pool/ObjectPoolFactory
>
> It looks like I am missing some basics here but unfortunately I am not
> able to find a solution to this little exercise.
>
> Can someone please push me in the right direction?


So the code you're using is exactly correct!

In earlier versions of Camel by default we'd use the
PooledConnectionFactory with ActiveMQ; so the exception you're getting
is just that commons-pool is not on the classpath. Our bad for not
making that clear.

FWIW in later versions fo Camel and ActiveMQ; the activemq component
ships with ActiveMQ itself in 5.0 or later; and we've moved from using
the PoolConnectionFactory to using the caching levels in the
MessageListenerContainer in spring to ensure transactional consistency
(so the above takes place in a single JMS transaction).

So when using ActiveMQ 5.0 or later and Camel 1.2 or later you'd not
get the above exception as we'd not be using the
PooledConnectionFactory

--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Question about re-routing to a different queue

jstrachan
On 09/10/2007, Andreas Guther <[hidden email]> wrote:

> James,
>
> Thank you for your help and solving the problem.
>
> Indeed I was running ActiveMQ 4.1.1 and Camel 1.1.0 yesterday.  I
> changed to Camel 1.2.0 but currently have to stay with ActiveMQ 4.1.1. I
> added the following dependency to the pom.xml file in the spring example
> folder:
>
> <dependency>
>       <groupId>commons-pool</groupId>
>       <artifactId>commons-pool</artifactId>
>       <version>1.3</version>
> </dependency>
>
> This allowed me to use the following change in the example router:
>
> from("jms:test.camel.MyQueue").
>                 to("file://target/test?noop=true",
> "jms:test.camel.MyQueue2");
>
>
> Camel is a really exiting project!  I can't wait to explore more pattern
> implementations.

Great, thanks for letting us know - and for the feedback! :)

--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com