Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this sample we let Camel expose a service that listen for TCP connections on port 6200. We use the textline codec meaning that we use the \n marker to indicate end-of-data. In out route we create the mina in the from to create the consumer that listen on port 6200:

...

As the sample is part of an unit test we test it by sending some data on port 6200 to it. Notice that we must append the \n character at the end to indicate end-of-data. This sample is a bit a typically as its async and we do not return an response.

Wiki Markup
{snippet:id=e2|lang=java|url=activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}

In the next sample we have a more common use-case where we expose a TCP service on port 6201 also using the textline codec. However this time we want to return a response and indicate that we support this so we add set the sync =option to true option on the consumer.

Wiki Markup
{snippet:id=e3|lang=java|url=activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaConsumerTest.java}

...