Hi

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.

Regards
Matt

----

A few snippets of what I have:


// SERVER
from(nettyUrl "sync is true as other messages can be synchronous, which is
why body set to null below and nothing returned")
  .setExchangePattern(ExchangePattern.InOptionalOut)
  .choice()
    .when().......
    .when()....[my message here]
       .transform(body().convertTo(Map.class))
         .to(ExchangePattern.InOnly, "activemq:queue:message") // send a
MapMessage
           .setBody(constant(null))
    .otherwise().....
  .stop();

// CLIENT - different class
from("timer://myTimer?delay=1s&fixedRate=false&period=2s")
  .setExchangePattern(ExchangePattern.InOnly)
  .process(new Processor() {
     @Override
     public void process(Exchange exchange) throws Exception
     {
       exchange.getIn().setBody(message);
       // this executes, but on the 11th execution, blocks      
     }
   }).to(ExchangePattern.InOnly, nettyUrl "sync is false")
   .stop();

// Client listening on the ActiveMQ queue
from("activemq:queue:message")
  .setExchangePattern(ExchangePattern.InOnly)
  .process(new Processor() {
    @Override
    public void process(Exchange exchange) throws Exception
    {
         // just logging the map message here and it it what expected for
first 10
         // then no more  
    }
  })
  .stop();

    

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Netty-Producer-creating-new-connection-on-every-message-tp4844805p4844805.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to