|
Replies:
12
-
Last Post:
Mar 12, 2012 8:03 AM
Last Post By: davsclaus
|
|
|
Posts:
9
Registered:
02/03/12
|
|
|
|
Simple Camel-Netty Examples/Issue?
Posted:
Mar 6, 2012 5:21 AM
|
|
|
Is there any good examples using the camel-netty component? We have a project in which we want to route some XML messages from a TCP connection to a JMS topic vice versa. At first I thought that camel-netty or camel-mina would be perfect for this. After some research it appeared that camel-netty is preferred over camel-mina so I started with a simple example. I currently have a timer feeding messages to a topic which is then sent out via netty, unfortunately it appears that only the first message is received by the server. Any ideas?
from("activemq:topic:topic.tcp.1.out")
.to("netty:tcp://localhost:4444?textline=true&sync=false");
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 6, 2012 8:55 AM
in response to: dr8ball
|
|
|
|
Are you sure the receiver is using the same codec as you? eg you specify textline, which means its a text based codec, that terminates with a newline.
You can add a .to("log:from-topic") in the route, so you can see in the log that you receive more messages from the topic.
|
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
|
Posts:
9
Registered:
02/03/12
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 7, 2012 3:50 AM
in response to: davsclaus
|
|
|
Thanks for the quick reply Claus. I have been enjoying your book "Camel in Action" and am looking forward to using FUSE. I have tinkered with Camel and FUSE ESB before but this is my first time to get to use it for one of our projects. If we can get this to work then my hope is that we will use it more.
The short answer is no, they are not using the same "codec", and yes multiple messages are being sent to my topic destination. My test is using just a basic BufferedReader wrapping an InputSteamReader for the server. What exactly do you mean when you say "terminates with a newline"?
The end goal is for camel-netty to be the bridge between an external TCP Server/Client and JMS topics. We do not have any control over the "External" server/client.
External TCP Server -> camel-netty-> some.topic.in -> Application (xml payload)
External TCP Client <- camel-netty <- some.topic.out <- Application (xml payload)
|
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
|
Posts:
9
Registered:
02/03/12
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 9, 2012 4:29 AM
in response to: davsclaus
|
|
|
|
After some more testing it appears that camel-netty client closes the socket after each message sent, since my test application was only accepting a single connection I was only seeing the first message. I did not see this behavior when testing with the camel-mina component. Is there something that I am missing in the configuration that would allow camel-netty to reuse the socket?
Is there any reasons that we should choose the camel-mina component over the camel-netty component? Are you planning to support both equally or is one preferred over the other?
|
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 9, 2012 5:40 AM
in response to: davsclaus
|
|
|
|
That said, a lot of people is using the camel-mina component since it has been there for a very long time, and it just works.
|
|
|
|
|
Posts:
9
Registered:
02/03/12
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 10, 2012 4:47 AM
in response to: davsclaus
|
|
|
|
OK, I think you have convinced me to go back to the camel-mina or camel-mina2 component but just so that I know, is there a way to prevent camel-netty from closing the socket after each message?
Regarding camel-mina2, is there a way to create a consumer that acts as a client instead of a server? I have seen the question in other threads but I wasn't sure if and how that would work in the camel-mina2 component. If not, is there a work around?
|
|
|
|
|
Posts:
9
Registered:
02/03/12
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 12, 2012 5:09 AM
in response to: davsclaus
|
|
|
|
Thanks for the info Claus! Is there a way that I can get in contact with the person who is working on this? I have an immediate need and if possible would like to either test the current solution or aid with a new solution.
Also, I would still like to know if there is a solution to my netty question so that I can mark it as answered. Is there a way to prevent camel-netty from closing the socket after each message?
|
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
Re: Simple Camel-Netty Examples/Issue?
Posted:
Mar 12, 2012 8:00 AM
in response to: dr8ball
|
|
|
Well camel-netty has the disconnect option, that by default is false
http://camel.apache.org/netty
To get in touch with the guy then try to find the ASF Camel JIRA ticket and post a comment there. And/or post on the Camel @user mailing list to get attention.
If you are a FuseSource subscriber you can use that channel to get help with this, such as influence our roadmap, get direct access to our engineering team who can help speedup this etc.
|
|
|
|
|
Posts:
1,871
Registered:
10/14/08
|
|
|
|
|
|