You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by BobH <rj...@gmail.com> on 2010/04/13 18:25:03 UTC

Camel mina component receiving connections but route not working

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.


Re: Camel mina component receiving connections but route not working

Posted by jorsion <jo...@gmail.com>.
Thanks

On Wed, Aug 3, 2011 at 9:00 PM, Jon Anstey [via ServiceMix] <
ml-node+4662207-1165614311-219808@n5.nabble.com> wrote:

> For a JUnit test case you can follow the example here:
>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaCustomCodecTest.java
>
> To use another type of registry (like Spring or OSGi) see section 4.3 for
> Camel in Action here: http://manning.com/ibsen/chapter4sample.pdf
>
>  On Thu, Jul 21, 2011 at 8:30 AM, jorsion <[hidden email]<http://user/SendEmail.jtp?type=node&node=4662207&i=0>>
> wrote:
>
> > Hi, I wrote a custm codec, but I do not know how to load the codec into
> > JndiRegistry.
> >
> > there is some snippet of the code
> >
> > public class MyRouteBuilder extends RouteBuilder {
> >
> >    public void configure() {
> >
> >        JndiRegistry jndi = new JndiRegistry();
> >        jndi.bind("creditCodec", new CreditCenterCodec());
> >
> >
> > from("jbi:endpoint:
> > http://test.com/CreditAgencyProxy/CreditAgencyProxyEndpoint")
> >                    .to("mina:tcp://
> > 127.0.0.1:63637?codec=#creditCodec&sync=false<http://127.0.0.1:63637/?codec=#creditCodec&sync=false>");
>
> >    }
> > }
> >
> > is the code OK?
> >
> > Best wishes.
> >
> > --
> > View this message in context:
> >
> http://servicemix.396122.n5.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp419767p4618962.html
> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Cheers,
> Jon
> ---------------
> FuseSource
> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=4662207&i=1>
> Web: fusesource.com
> Twitter: jon_anstey
> Blog: http://janstey.blogspot.com
> Author of Camel in Action: http://manning.com/ibsen
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://servicemix.396122.n5.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp419767p4662207.html
> To unsubscribe from Camel mina component receiving connections but route
> not working, click here<http://servicemix.396122.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=419767&code=am9yc2lvbkBnbWFpbC5jb218NDE5NzY3fC0xNDM0Njg0NzU5>.
>
>



-- 
JoSn


--
View this message in context: http://servicemix.396122.n5.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp419767p4665372.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Camel mina component receiving connections but route not working

Posted by Jon Anstey <ja...@gmail.com>.
For a JUnit test case you can follow the example here:
https://svn.apache.org/repos/asf/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaCustomCodecTest.java

To use another type of registry (like Spring or OSGi) see section 4.3 for
Camel in Action here: http://manning.com/ibsen/chapter4sample.pdf

On Thu, Jul 21, 2011 at 8:30 AM, jorsion <jo...@gmail.com> wrote:

> Hi, I wrote a custm codec, but I do not know how to load the codec into
> JndiRegistry.
>
> there is some snippet of the code
>
> public class MyRouteBuilder extends RouteBuilder {
>
>    public void configure() {
>
>        JndiRegistry jndi = new JndiRegistry();
>        jndi.bind("creditCodec", new CreditCenterCodec());
>
>
> from("jbi:endpoint:
> http://test.com/CreditAgencyProxy/CreditAgencyProxyEndpoint")
>                    .to("mina:tcp://
> 127.0.0.1:63637?codec=#creditCodec&sync=false");
>    }
> }
>
> is the code OK?
>
> Best wishes.
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp419767p4618962.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>



-- 
Cheers,
Jon
---------------
FuseSource
Email: jon@fusesource.com
Web: fusesource.com
Twitter: jon_anstey
Blog: http://janstey.blogspot.com
Author of Camel in Action: http://manning.com/ibsen

Re: Camel mina component receiving connections but route not working

Posted by jorsion <jo...@gmail.com>.
Hi, I wrote a custm codec, but I do not know how to load the codec into
JndiRegistry.

there is some snippet of the code

public class MyRouteBuilder extends RouteBuilder {

    public void configure() {

    	JndiRegistry jndi = new JndiRegistry();
    	jndi.bind("creditCodec", new CreditCenterCodec());

	
from("jbi:endpoint:http://test.com/CreditAgencyProxy/CreditAgencyProxyEndpoint") 
	    	    .to("mina:tcp://127.0.0.1:63637?codec=#creditCodec&sync=false");	
    }
}

is the code OK?

Best wishes.

--
View this message in context: http://servicemix.396122.n5.nabble.com/Camel-mina-component-receiving-connections-but-route-not-working-tp419767p4618962.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Camel mina component receiving connections but route not working

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Apr 13, 2010 at 8:21 PM, BobH <rj...@gmail.com> 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 <rj...@gmail.com> 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

Re: Camel mina component receiving connections but route not working

Posted by BobH <rj...@gmail.com>.
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.

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 <rj...@gmail.com> 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.


Re: Camel mina component receiving connections but route not working

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Its a textline codec, so try sending some text like "Hello World\n"


On Tue, Apr 13, 2010 at 6:25 PM, BobH <rj...@gmail.com> 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