You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by frank1970 <ma...@gmail.com> on 2015/02/03 09:30:53 UTC
Routing messages to ActiveMQ queue
Hi all!
I'm trying to route some messages to an ActiveMQ server. Basically I'd need
to rewrite the tomcat-active-example to use Camel Java API and run in on
another application server.
So I have started ActiveMQ on my machine and defined a queue named
"activemq/queue/TestQueue".
Next I have coded as follows the connection to ActiveMQ:
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
"tcp://0.0.0.0:61616");
context.addComponent("jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
context.addRoutes(new RouteBuilder() {
public void configure() {
from("timer:foo?period=1s").setBody(body().append("Message at
${date:now:yyyy-MM-dd HH:mm:ss}")).to("jms:activemq:/queue/TestQueue");
}
});
The application executes without any error, however surfing on the ActiveMQ
console I can see no messages have been received by any consumer. Any idea
what's wrong with it?
Thanks
Frank
--
View this message in context: http://camel.465427.n5.nabble.com/Routing-messages-to-ActiveMQ-queue-tp5762345.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Routing messages to ActiveMQ queue
Posted by frank1970 <ma...@gmail.com>.
Thanks for your reply. Actually I've just found out the issue: I was missing
some libs in the classpath and without including SLF4J (both libraries)
these exceptions were hidden. Now it's working :-)
--
View this message in context: http://camel.465427.n5.nabble.com/Routing-messages-to-ActiveMQ-queue-tp5762345p5762347.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Routing messages to ActiveMQ queue
Posted by Morgan Hautman <mo...@gmail.com>.
HI Frank,
Try with this :
from("timer:foo?period=1s").setBody(body().append("Message at
${date:now:yyyy-MM-dd HH:mm:ss}")).to("|activemq:|activemq/queue/TestQueue
");
activemq:
http://camel.apache.org/activemq.html
On 3/02/2015 9:30, frank1970 wrote:
> Hi all!
> I'm trying to route some messages to an ActiveMQ server. Basically I'd need
> to rewrite the tomcat-active-example to use Camel Java API and run in on
> another application server.
> So I have started ActiveMQ on my machine and defined a queue named
> "activemq/queue/TestQueue".
> Next I have coded as follows the connection to ActiveMQ:
>
> CamelContext context = new DefaultCamelContext();
> ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(
> "tcp://0.0.0.0:61616");
> context.addComponent("jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
> context.addRoutes(new RouteBuilder() {
> public void configure() {
> from("timer:foo?period=1s").setBody(body().append("Message at
> ${date:now:yyyy-MM-dd HH:mm:ss}")).to("jms:activemq:/queue/TestQueue");
> }
> });
>
> The application executes without any error, however surfing on the ActiveMQ
> console I can see no messages have been received by any consumer. Any idea
> what's wrong with it?
> Thanks
> Frank
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Routing-messages-to-ActiveMQ-queue-tp5762345.html
> Sent from the Camel - Users mailing list archive at Nabble.com.