On Thu, Nov 22, 2012 at 8:04 AM, Mikael Fernandus S <mika...@gmail.com> wrote:
> Hi,
>
> While testing Camel Mina 2 component, we noticed that big message
> payload received via UDP endpoint was always truncated to 2048 bytes
> at Mina2Consumer. We did some investigation and found out that this
> problem was caused by the default UDP codec. Comparing default UDP
> codec in Mina 2 with its counterpart in Mina 2, the different behavior
> might be caused by the replacement of ByteBuffer with IoBuffer and
> setting auto expand value to true (even though this may seem counter
> intuitive).
>
> Camel - Mina (MinaUdpProtocolCodecFactory):
> ...
>             private ByteBuffer toByteBuffer(Object message, CharsetEncoder 
> encoder)
>                 throws CharacterCodingException, 
> NoTypeConversionAvailableException {
>                 String value =
> context.getTypeConverter().convertTo(String.class, message);
>                 if (value != null) {
>                     ByteBuffer answer =
> ByteBuffer.allocate(value.length()).setAutoExpand(false);
>                     answer.putString(value, encoder);
>                     return answer;
>                 }
>
>                 // failback to use a byte buffer converter
>                 return
> context.getTypeConverter().mandatoryConvertTo(ByteBuffer.class,
> message);
>             }
>
> Camel - Mina 2 (Mina2UdpProtocolCodecFactory):
> ...
>     private IoBuffer toIoBuffer(Object message, CharsetEncoder encoder)
>                 throws CharacterCodingException, 
> NoTypeConversionAvailableException {
>                 String value =
> context.getTypeConverter().convertTo(String.class, message);
>                 if (value != null) {
>                     IoBuffer answer =
> IoBuffer.allocate(value.length()).setAutoExpand(true);
>                     answer.putString(value, encoder);
>                     return answer;
>                 }
>
>                 // failback to use a byte buffer converter
>                 return
> context.getTypeConverter().mandatoryConvertTo(IoBuffer.class,
> message);
>             }
>
>
> We would like to know if this issue is also reproducible by others.
> Camel version we use for this testing is 2.10.2.
>

So have you tried with setting auto expand = false in camel-mina2, and
see if that fixes the issue for you?


> Regards,
> Mike



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to