Ok, So I decided to go back to the drawing board and decided to run some
tests.
First, I implemented a very simple decoder that contains the following code:
@Override
protected boolean doDecode(IoSession is, IoBuffer ib,
ProtocolDecoderOutput pdo) throws Exception {
System.out.println("IoBuffer hasRemaining: " + ib.hasRemaining());
System.out.println("IoBuffer remaining: " + ib.remaining());
byte[] data = new byte[ib.remaining()];
ib.get(data);
System.out.println("IoBuffer read: " + new String(data));
return true;
}
Then I implemented my route in the camel-context as...
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route>
<camel:from
uri="mina2:tcp://10.5.60.60:9000?codec=#gilbarcoDecoder" />
<camel:bean ref="testBean"/>
</camel:route>
</camel:camelContext>
When I run this it will successfully read the input and output the received
message to the console. However when I change the route to..
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route>
<camel:from
uri="mina2:tcp://10.5.60.60:9000?disconnectOnNoReply=false;codec=#gilbarcoDecoder"
/>
<camel:bean ref="testBean"/>
</camel:route>
</camel:camelContext>
Then I get the following error message and it never calls the doDecode
method..
org.apache.camel.CamelException:
org.apache.mina.filter.codec.ProtocolDecoderException:
org.apache.mina.core.buffer.BufferDataException: dataLength: 1347375948
(Hexdump: REMOVED FOR BREVITY)
at
org.apache.camel.component.mina2.Mina2Consumer$ReceiveHandler.exceptionCaught(Mina2Consumer.java:312)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.exceptionCaught(DefaultIoFilterChain.java:672)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:461)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1100(DefaultIoFilterChain.java:47)
at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.exceptionCaught(DefaultIoFilterChain.java:760)
at
org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:93)
at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
at
org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769)
at
org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761)
at
org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703)
at java.lang.Thread.run(Thread.java:722)
Not sure exactly why this is occurring. Is it the way I have configured my
route? Or is this a bug in the Mina2 2.11.1 component?
- Tim
--
View this message in context:
http://camel.465427.n5.nabble.com/Mina-Synchronous-Communication-tp5737223p5737692.html
Sent from the Camel - Users mailing list archive at Nabble.com.