1 Reply Latest reply on Mar 2, 2010 4:58 PM by Tim O'Malley

    Problem with Camel/Mina in fuse-esb-3.3.1.11.

    Tim O'Malley Newbie

      After upgrading from ServiceMix version 3.2.2 to fuse-esb.3.3.1.11, an existing application no longer works.   It is a relatively simple application that uses a camel/mina codec to listen on a port to receive incoming requests.

       

      The behavior we are seeing now is that only one incoming message is being processed. It looks like the following class is only called once per session, even though there is more data arriving via the channel.

       

      Here is the portial of the codec that seems to be having the problem.

       

      DistributeResponseDecoder.java:

       

      package fuse_distribute_codec;

       

      import org.apache.mina.common.IoSession;

      import org.apache.mina.common.ByteBuffer;

      import org.apache.mina.filter.codec.CumulativeProtocolDecoder;

      import org.apache.mina.filter.codec.ProtocolDecoderOutput;

       

       

      /*

      import org.apache.mina.common.IoSession;

      import org.apache.mina.core.buffer.ByteBuffer;

      */

       

      public class DistributeRequestDecoder extends CumulativeProtocolDecoder {

       

       

         protected boolean doDecode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception {

              if (in.prefixedDataAvailable(4)) {

                  int length = in.getInt();

                  byte[] bytes = new byte[length];

                  in.get(bytes);

       

                  String xmlMessage = new String(bytes, "ISO-8859-1");

                  out.write(xmlMessage);

                  return true;

              } else {

                  return false;

              }

          }

      }

       

       

      The camel SU is as follows.

       

      MyRouteBuilder.java:

       

      package fuse_publish;

       

      import org.apache.camel.builder.RouteBuilder;

       

      /**

       

      • A Camel Router

      *

       

      • @version $Revision: 1.1 $

      */

      public class MyRouteBuilder extends RouteBuilder {

       

          public void configure() {

               from("mina:tcp://localhost:7000?codec=distributeCodec&minaLogger=true&sync=false")

                .to("jbi:endpoint:http://www.xxx.xxx/publish/pipeline/publishRoute");

          }

      }