On Tue, Apr 13, 2010 at 8:21 PM, BobH <[email protected]> wrote:
>
> Wow that was easy... That worked, thank you.
>
> So, maybe another easy question for you - when I remove the textline=true, I
> cannot write ints / bytes to the socket as I was trying to do above.
>

Then the Mina ObjectSerializedCodec is used (or whatever that name
was). That codec can transfer Java objects.
If you want to transfer something custom you have to write you own mina codec.

Apache Mina web site have some examples. And also camel-hl7 has a
custom mina codec.


> Code such as:
>
> Socket client = new Socket("localhost", 6200);
> OutputStream out = client.getOutputStream();
> DataOutputStream dOut = new DataOutputStream( out );
> dOut.write( 1 );
> dOut.write( 4 );
> dOut.write( 6 );
> dOut.write( 8 );
> dOut.flush();
> dOut.close();
>
> Produces:
>
> $ReceiveHandler - [/127.0.0.1:52896] Unexpected exception from exception
> Caught handler.org.apache.camel.CamelException:
> org.apache.mina.filter.codec.ProtocolDecoderException:
> org.apache.mina.common.BufferDataException: dataLength: 17040904 (Hexdump:
> 01 04 06 08)
>        at
> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exception
> Caught(MinaConsumer.java:88)
>        at
> org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.excep
> tionCaught(AbstractIoFilterChain.java:564)
>
> Is there another option/codec that I should be using?
>
> Thanks,
> Bob
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> Its a textline codec, so try sending some text like "Hello World\n"
>>
>>
>> On Tue, Apr 13, 2010 at 6:25 PM, BobH <[email protected]> wrote:
>>>
>>> I've been trying to debug this for hours and I cannot figure out what's
>>> going
>>> on.  I have a camel route which creates a mina consumer endpoint that
>>> forwards to a logging endpoint:
>>>
>>> from(
>>> "mina:tcp://localhost:6200?textline=true&minaLogger=true&sync=false" )
>>>      .to( "log:com.company.TestMinaRoute" );
>>>
>>> When I connect with my client code and send data:
>>>
>>> Socket client = new Socket("localhost", 6200);
>>> OutputStream out = client.getOutputStream();
>>> DataOutputStream dOut = new DataOutputStream( out );
>>> dOut.write( 1 );
>>> dOut.write( 4 );
>>> dOut.write( 6 );
>>> dOut.write( 8 );
>>> dOut.flush();
>>> dOut.close();
>>>
>>> I see the following in the servicemix console:
>>>
>>> 1190080 [SocketAcceptorIoProcessor-4.0] INFO
>>> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler -
>>> [/127.0.0.1:52101] CREATED
>>>
>>> 1190083 [AnonymousIoService-6] INFO
>>> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler -
>>> [/127.0.0.1:52101] OPENED
>>>
>>> 1190085 [AnonymousIoService-6] INFO
>>> org.apache.camel.component.mina.MinaConsumer$ReceiveHandler -
>>> [/127.0.0.1:52101] CLOSED
>>>
>>> Which makes complete sense to me.  This output comes from the
>>> minaLogger=true parameter.  I should also see log output for my logging
>>> "to"
>>> endpoint, at "com.company.TestMinaRoute".  Not only does this not work,
>>> but
>>> if I try to add a processing class, I also get nothing:
>>>
>>> from(
>>> "mina:tcp://localhost:6200?textline=true&minaLogger=true&sync=false"
>>> ).process( new Processor() {
>>>      public void process(Exchange exchng) throws Exception {
>>>        System.out.println( "Some processing is happening!!!" );
>>>      }
>>> });
>>>
>>> Does anyone have any idea what I'm doing wrong?  I'm using ServiceMix
>>> 3.3.1,
>>> which comes with camel 1.6.0, so the mina dependencies are also 1.6.0,
>>> which
>>> resolve to the following (plus a few others for spring support):
>>>
>>> backport-util-concurrent-2.2.jar
>>> camel-core-1.6.0.jar
>>> camel-mina-1.6.0-sources.jar
>>> camel-mina-1.6.0.jar
>>> commons-collections-3.1.jar
>>> commons-logging-api-1.1.jar
>>> mina-core-1.1.7.jar
>>> slf4j-api-1.5.5.jar
>>> slf4j-simple-1.5.5.jar
>>> spring-beans-2.0.6.jar
>>> spring-context-2.0.6.jar
>>> spring-core-2.0.6.jar
>>> stax-api-1.0.1.jar
>>> xercesImpl-2.8.1.jar
>>> xml-apis-1.3.04.jar
>>>
>>> Thanks,
>>> Bob
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp28232642p28232642.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp28232642p28233916.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to