camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maccamlc <>
Subject Camel Netty Producer creating new connection on every message?
Date Tue, 27 Sep 2011 10:19:30 GMT

I am very new to Camel, and trying to implement some simple messaging to get
a feel for the basics.

Currently I have a simple Server using Camel Netty to listen for messages in
Request Only mode. It then sends the message it received via ActiveMQ, also
in Request Only mode. This seems to be working, although I find it a little
strange that I receive a message "Successfully connected to
tcp://localhost:61616" twice for every 1 posting to the queue. Is it
supposed to connect every time?

But then on my Client is am also using Camel Netty with a timer that
triggers and sends a new message to the socket. This is also Request Only
with the Camel Netty option "sync" set to false. The message is sent fine,
and I see the message being received by the server and send over ActiveMQ.
All is good.

However after 10 messages it stops working, and blocks on the
to("netty://tcp....") part of the route. I am not sure exactly where it is
blocking, as have not had a chance to debug completely yet.

I have noticed that a new Channel is created for every message I write, as I
have seen that the NettyProducer opens a new Channel every time. Is this
also expected? As I said, I am still very new to Camel :)

I think Camel will be brilliant for what I need to do, but at the moment any
assistance on helping me understand my current problem will be great.



A few snippets of what I have:

from(nettyUrl "sync is true as other messages can be synchronous, which is
why body set to null below and nothing returned")
    .when()....[my message here]
         .to(ExchangePattern.InOnly, "activemq:queue:message") // send a

// CLIENT - different class
  .process(new Processor() {
     public void process(Exchange exchange) throws Exception
       // this executes, but on the 11th execution, blocks	
   }).to(ExchangePattern.InOnly, nettyUrl "sync is false")

// Client listening on the ActiveMQ queue
  .process(new Processor() {
    public void process(Exchange exchange) throws Exception
         // just logging the map message here and it it what expected for
first 10
         // then no more  


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message