You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nil <ic...@hotmail.com> on 2013/03/07 11:40:47 UTC
Camel mina : data truncated to 1024 bytes
Hi,
I'm using camel mina component configured like this :
<bean id="myMinaConfig"
class="org.apache.camel.component.mina.MinaConfiguration">
<property name="protocol" value="tcp" />
<property name="host" value="${tcp.ip}" />
<property name="port" value="${tcp.port}" />
<property name="sync" value="false" />
<property name="minaLogger" value="${tcp.minaLogger}" />
<property name="codec" ref="myCodecFactory" />
<property name="transferExchange" value="false" />
</bean>
My problem is data are always truncated to 1024 first bytes.
I try using
<property name="encoderMaxLineLength" value="2048"/>
<property name="decoderMaxLineLength" value="2048" />
in my Mina Configuration but no effect.
Is there something i'm doing wrong
Thanks for your reply
NIL
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel mina : data truncated to 1024 bytes
Posted by nil <ic...@hotmail.com>.
I forget to tell that i'm using camel 2.10.0
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733p5728735.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel mina : data truncated to 1024 bytes
Posted by Christian Müller <ch...@gmail.com>.
Which codec factory do you use (you didn't show us the configuration)?
TextLineCodecFactory? -> encoderMaxLineLength/decoderMaxLineLength are
applied.
ObjectSerializationCodecFactory? ->
encoderMaxLineLength/decoderMaxLineLength are *NOT* applied.
A custom?
Best,
Christian
On Thu, Mar 7, 2013 at 11:40 AM, nil <ic...@hotmail.com> wrote:
> Hi,
>
> I'm using camel mina component configured like this :
>
> <bean id="myMinaConfig"
> class="org.apache.camel.component.mina.MinaConfiguration">
> <property name="protocol" value="tcp" />
> <property name="host" value="${tcp.ip}" />
> <property name="port" value="${tcp.port}" />
> <property name="sync" value="false" />
> <property name="minaLogger" value="${tcp.minaLogger}" />
> <property name="codec" ref="myCodecFactory" />
> <property name="transferExchange" value="false" />
>
> </bean>
>
> My problem is data are always truncated to 1024 first bytes.
>
> I try using
>
> <property name="encoderMaxLineLength" value="2048"/>
> <property name="decoderMaxLineLength" value="2048" />
>
> in my Mina Configuration but no effect.
>
> Is there something i'm doing wrong
>
> Thanks for your reply
>
> NIL
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Re: Camel mina : data truncated to 1024 bytes
Posted by Christian Müller <ch...@gmail.com>.
Good to know you could figure it out by yourself.
Best,
Christian
Sent from a mobile device
Am 07.03.2013 23:44 schrieb "nil" <ic...@hotmail.com>:
> We finally find the problem which was in our ProtocolEncoder
> implementation.
> In fact, the doDecode was reading just 1024 first bytes in the ByteBuffer
> whereas our frame (which know its length) was indicating more bytes. To
> prevent that, we resume reading in IoSession and returns false in doDocode
> if our length is not the same as remaining in the ByteBuffer.
>
> Thanks for all.
>
> NIL
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733p5728804.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Camel mina : data truncated to 1024 bytes
Posted by nil <ic...@hotmail.com>.
We finally find the problem which was in our ProtocolEncoder implementation.
In fact, the doDecode was reading just 1024 first bytes in the ByteBuffer
whereas our frame (which know its length) was indicating more bytes. To
prevent that, we resume reading in IoSession and returns false in doDocode
if our length is not the same as remaining in the ByteBuffer.
Thanks for all.
NIL
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733p5728804.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel mina : data truncated to 1024 bytes
Posted by Christian Müller <ch...@gmail.com>.
Did you already checked this test:
https://svn.apache.org/repos/asf/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMCustomCodecTest.java
And there are much more:
https://svn.apache.org/repos/asf/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/
Best,
Christian
On Thu, Mar 7, 2013 at 2:35 PM, nil <ic...@hotmail.com> wrote:
> Hi,
>
> Thanks for reply.
> However, I don't see how to set this property in my app.
>
> We effectively have a custom codec
>
> <bean id="myCodecFactory" class="com.xxx.codec.CodecFactory">
> <property name="translator" ref="translator" />
> </bean>
> <bean id="translator" class="com.xxx.codec.PacketTranslator">
> <property name="listTranslator">
> <ref bean="v0" />
> </property>
> </bean>
>
> We try to extends our codec factory with TextLineDecoder to override
> maxLineLength attribut or to extends ObjectSerializationEncoder with
> maxObjectSize = Integer.MAX_VALUE; by default.
>
> I think i don't look at the good part of code.
>
> Any idea?
>
> Thanks a lot
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733p5728754.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Re: Camel mina : data truncated to 1024 bytes
Posted by nil <ic...@hotmail.com>.
Hi,
Thanks for reply.
However, I don't see how to set this property in my app.
We effectively have a custom codec
<bean id="myCodecFactory" class="com.xxx.codec.CodecFactory">
<property name="translator" ref="translator" />
</bean>
<bean id="translator" class="com.xxx.codec.PacketTranslator">
<property name="listTranslator">
<ref bean="v0" />
</property>
</bean>
We try to extends our codec factory with TextLineDecoder to override
maxLineLength attribut or to extends ObjectSerializationEncoder with
maxObjectSize = Integer.MAX_VALUE; by default.
I think i don't look at the good part of code.
Any idea?
Thanks a lot
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733p5728754.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel mina : data truncated to 1024 bytes
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
What Camel version do you use?
I think when you use a custom codec, eg myCodecFactory
Then you need to handle the line length in your codec.
I think encoderMaxLineLength is only in use when using the out of box
textline codec.
On Thu, Mar 7, 2013 at 11:40 AM, nil <ic...@hotmail.com> wrote:
> Hi,
>
> I'm using camel mina component configured like this :
>
> <bean id="myMinaConfig"
> class="org.apache.camel.component.mina.MinaConfiguration">
> <property name="protocol" value="tcp" />
> <property name="host" value="${tcp.ip}" />
> <property name="port" value="${tcp.port}" />
> <property name="sync" value="false" />
> <property name="minaLogger" value="${tcp.minaLogger}" />
> <property name="codec" ref="myCodecFactory" />
> <property name="transferExchange" value="false" />
>
> </bean>
>
> My problem is data are always truncated to 1024 first bytes.
>
> I try using
>
> <property name="encoderMaxLineLength" value="2048"/>
> <property name="decoderMaxLineLength" value="2048" />
>
> in my Mina Configuration but no effect.
>
> Is there something i'm doing wrong
>
> Thanks for your reply
>
> NIL
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-mina-data-truncated-to-1024-bytes-tp5728733.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen