You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by milltj <mi...@drop-tank.com> on 2013/08/21 20:38:40 UTC

Incomplete Messages

I have been playing with the Mina2 component and have a need to implement my
own decoder.  The messages that I receive have a 28 byte header followed by
a variable length XML message.  The header contains the length of the XML
message as well as some other information.  I am running into a problem that
in some cases the reported XML length in the header is greater then the what
is reported when calling in.remaining().  For example, the XML Length header
contains a length of 2735 bytes, but the in.remaining() reports 2020.  if I
call in.get(byte[]) and pass it a byte array of size 2735, I get an
UnderrunException.  If I only retrieve the bytes in the buffer then I get an
incomplete message. I have looked at the example at the Mina website but I
am confused by it, I don't quite follow what it is doing.  Can someone point
me to an example of what I would need to implement in my doDecode(...)
method that would insure I get a complete message everytime? 

Thanks!
- Tim



--
View this message in context: http://camel.465427.n5.nabble.com/Incomplete-Messages-tp5737696.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incomplete Messages

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

Maybe take a peak at camel-hl7 as it has a mina codec for the hl7
format. So it may be of inspiration.

On Thu, Aug 22, 2013 at 12:26 AM, milltj <mi...@drop-tank.com> wrote:
> Actually; the header sent from the caller is sending the correct size for the
> XML body of the message.  I found that there are multiple calls to the
> doDecode(...) method that have to be combined to put together the whole
> message before returning the message.
>
> Tim
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Re-Incomplete-Messages-tp5737700p5737708.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Incomplete Messages

Posted by milltj <mi...@drop-tank.com>.
Actually; the header sent from the caller is sending the correct size for the
XML body of the message.  I found that there are multiple calls to the
doDecode(...) method that have to be combined to put together the whole
message before returning the message.

Tim




--
View this message in context: http://camel.465427.n5.nabble.com/Re-Incomplete-Messages-tp5737700p5737708.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Incomplete Messages

Posted by Christian Müller <ch...@gmail.com>.
I suggest to reporg the problem to the sending application. They should
sent the correct content size.
IF you have to deal with this issue, I suggest to post this question to the
mina user list, becausr this isn't really a Camel question.

Best,
Christian
Am 21.08.2013 20:39 schrieb "milltj" <mi...@drop-tank.com>:

> I have been playing with the Mina2 component and have a need to implement
> my
> own decoder.  The messages that I receive have a 28 byte header followed by
> a variable length XML message.  The header contains the length of the XML
> message as well as some other information.  I am running into a problem
> that
> in some cases the reported XML length in the header is greater then the
> what
> is reported when calling in.remaining().  For example, the XML Length
> header
> contains a length of 2735 bytes, but the in.remaining() reports 2020.  if I
> call in.get(byte[]) and pass it a byte array of size 2735, I get an
> UnderrunException.  If I only retrieve the bytes in the buffer then I get
> an
> incomplete message. I have looked at the example at the Mina website but I
> am confused by it, I don't quite follow what it is doing.  Can someone
> point
> me to an example of what I would need to implement in my doDecode(...)
> method that would insure I get a complete message everytime?
>
> Thanks!
> - Tim
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Incomplete-Messages-tp5737696.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>