You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Yiannis Mavroukakis <im...@gameaccountnetwork.com> on 2010/10/23 00:26:53 UTC

Camel-netty configuration question

Hello fellow listers,

I'm trying to achieve the following setup. I need a netty socket, that will
accept xml as a byte stream terminated by 0x00.
So far I have this config setup in spring DSL

   <bean id="nullDelimiter" class=
"org.jboss.netty.handler.codec.frame.Delimiters"

 factory-method="nulDelimiter" />

<bean id="delim-decoder"

 class="org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder">

 <constructor-arg value="8192" />

 <constructor-arg ref="nullDelimiter" />

</bean>

   <from uri="netty:tcp://
127.0.0.1:5155?sync=false&amp;decoders=#delim-decoder" />

<unmarshal>

 <jaxb contextPath="com.gameaccount.ermis.events" />

</unmarshal>

.....



I also have a separate piece of Mina code that reads an XML file to a byte
array, slaps a NULL (0x00) at the end of the array and sends it
off..to be met by stoney silence at the netty producer. My question is, have
I setup the netty producer correctly with respects to what I
want it to do? If I have, at least I know to concentrate my efforts on the
client code..

TIA

Yiannis

Re: Camel-netty configuration question

Posted by Yiannis Mavroukakis <im...@gameaccountnetwork.com>.
And I just solved it with this :-)

   <util:list id="decoders" list-class="java.util.LinkedList">

 <bean id="delim-decoder"

 class="org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder">

 <constructor-arg value="10240" />

 <constructor-arg ref="nullDelimiter" />

 </bean>

 <bean class="org.jboss.netty.handler.codec.string.StringDecoder" />

</util:list>



On 23 October 2010 22:00, Yiannis Mavroukakis <
imavroukakis@gameaccountnetwork.com> wrote:

> Looks like my messup was with the client code, but I am now getting this
> error
>
>
> [    New I/O server worker #1-1] ServerChannelHandler           DEBUG
> Incoming message: BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544)
> [    New I/O server worker #1-1] DefaultErrorHandler            DEBUG
> Failed delivery for exchangeId: 70e8aa5a-ad34-454c-b12f-c5ac3234070c. On
> delivery attempt: 0 caught: org.apache.camel.InvalidPayloadException: No
> body available of type: java.io.InputStream but has value:
> BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544) of type:
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer on: Message:
> BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544). Caused by: No type
> converter available to convert from type:
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
> java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
> cap=544). Exchange[Message: BigEndianHeapChannelBuffer(ridx=0, widx=544,
> cap=544)]. Caused by: [org.apache.camel.NoTypeConversionAvailableException -
> No type converter available to convert from type:
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
> java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
> cap=544)]
>
> ....
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
> converter available to convert from type:
> org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
> java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
> cap=544)
>  at
> org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:132)
> at
> org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
>  ... 50 more
>
> Is this a bug, or is something missing from my configuration of the netty
> endpoint?
>
> Thanks,
>
> Yiannis
>
> On 22 October 2010 23:26, Yiannis Mavroukakis <
> imavroukakis@gameaccountnetwork.com> wrote:
>
>> Hello fellow listers,
>>
>> I'm trying to achieve the following setup. I need a netty socket, that
>> will accept xml as a byte stream terminated by 0x00.
>> So far I have this config setup in spring DSL
>>
>> <bean id="nullDelimiter" class=
>> "org.jboss.netty.handler.codec.frame.Delimiters"
>>
>>  factory-method="nulDelimiter" />
>>
>> <bean id="delim-decoder"
>>
>>  class="org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder">
>>
>>  <constructor-arg value="8192" />
>>
>>  <constructor-arg ref="nullDelimiter" />
>>
>> </bean>
>>
>> <from uri="netty:tcp://
>> 127.0.0.1:5155?sync=false&amp;decoders=#delim-decoder<http://127.0.0.1:5155?sync=false&decoders=#delim-decoder>
>> " />
>>
>> <unmarshal>
>>
>>  <jaxb contextPath="com.gameaccount.ermis.events" />
>>
>> </unmarshal>
>>
>> .....
>>
>>
>>
>> I also have a separate piece of Mina code that reads an XML file to a byte
>> array, slaps a NULL (0x00) at the end of the array and sends it
>> off..to be met by stoney silence at the netty producer. My question is,
>> have I setup the netty producer correctly with respects to what I
>> want it to do? If I have, at least I know to concentrate my efforts on the
>> client code..
>>
>> TIA
>>
>> Yiannis
>>
>
>

Re: Camel-netty configuration question

Posted by Yiannis Mavroukakis <im...@gameaccountnetwork.com>.
Looks like my messup was with the client code, but I am now getting this
error


[    New I/O server worker #1-1] ServerChannelHandler           DEBUG
Incoming message: BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544)
[    New I/O server worker #1-1] DefaultErrorHandler            DEBUG Failed
delivery for exchangeId: 70e8aa5a-ad34-454c-b12f-c5ac3234070c. On delivery
attempt: 0 caught: org.apache.camel.InvalidPayloadException: No body
available of type: java.io.InputStream but has value:
BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544) of type:
org.jboss.netty.buffer.BigEndianHeapChannelBuffer on: Message:
BigEndianHeapChannelBuffer(ridx=0, widx=544, cap=544). Caused by: No type
converter available to convert from type:
org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
cap=544). Exchange[Message: BigEndianHeapChannelBuffer(ridx=0, widx=544,
cap=544)]. Caused by: [org.apache.camel.NoTypeConversionAvailableException -
No type converter available to convert from type:
org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
cap=544)]

....
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type:
java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=544,
cap=544)
 at
org.apache.camel.impl.converter.DefaultTypeConverter.mandatoryConvertTo(DefaultTypeConverter.java:132)
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
 ... 50 more

Is this a bug, or is something missing from my configuration of the netty
endpoint?

Thanks,

Yiannis

On 22 October 2010 23:26, Yiannis Mavroukakis <
imavroukakis@gameaccountnetwork.com> wrote:

> Hello fellow listers,
>
> I'm trying to achieve the following setup. I need a netty socket, that will
> accept xml as a byte stream terminated by 0x00.
> So far I have this config setup in spring DSL
>
> <bean id="nullDelimiter" class=
> "org.jboss.netty.handler.codec.frame.Delimiters"
>
>  factory-method="nulDelimiter" />
>
> <bean id="delim-decoder"
>
>  class="org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder">
>
>  <constructor-arg value="8192" />
>
>  <constructor-arg ref="nullDelimiter" />
>
> </bean>
>
> <from uri="netty:tcp://
> 127.0.0.1:5155?sync=false&amp;decoders=#delim-decoder<http://127.0.0.1:5155?sync=false&decoders=#delim-decoder>
> " />
>
> <unmarshal>
>
>  <jaxb contextPath="com.gameaccount.ermis.events" />
>
> </unmarshal>
>
> .....
>
>
>
> I also have a separate piece of Mina code that reads an XML file to a byte
> array, slaps a NULL (0x00) at the end of the array and sends it
> off..to be met by stoney silence at the netty producer. My question is,
> have I setup the netty producer correctly with respects to what I
> want it to do? If I have, at least I know to concentrate my efforts on the
> client code..
>
> TIA
>
> Yiannis
>