On 14/11/2007, James Chamberlain <[EMAIL PROTECTED]> wrote:
> The test case is working for me from home. The caveat is that at home I
> run on Linux and use jdk 1.6.x and before I was running tests at work on
> OSX with 1.5.0_13.
FWIW I'm using OS X on 1.5 too
> The problem is that my real cases still don't seem to
> work properly. If I took your test case below and removed the portion
> that feeds the udp traffic from the file and tried to feed it myself
> from another process that is not working for me. Below is some example
> UDP code that I was using to drive it:
>
> DatagramSocket socket = new DatagramSocket();
> byte buffer[] = new byte[1500];
> buffer = "TEST_STRING".getBytes();
> InetAddress address = InetAddress.getByName("127.0.0.1");
> DatagramPacket packet = new DatagramPacket(buffer,
> buffer.length, address, 9123);
> while(true) {
> socket.send(packet);
> Thread.sleep(2000);
> }
>
> Camel never seems to recognize those udp messages. Shouldn't this work
> or am I using it in an improper way?
Great catch! This had me stuck a little while!
It turned out mostly to be that the default codec's (textline and
serialization) don't work that well on UDP/multicast. So I've modified
the MinaComponent to by default use a simple ByteBuffer based codec -
so that the ByteBuffer is currently visible to the consumer in Camel.
I've created a test case pretty much as you describe which now seems
to be working fine. I raised this JIRA to track the issues...
https://issues.apache.org/activemq/browse/CAMEL-225
I've just commit a fix for this, so hopefully using trunk you'll be
able to use it fine to consume UDP messages.
I've also added a more flexible way of configuring the codec if you
wish to supply your own implementation via the registry etc...
http://cwiki.apache.org/CAMEL/mina.html
--
James
-------
http://macstrac.blogspot.com/
Open Source SOA
http://open.iona.com