You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by peter royal <pr...@apache.org> on 2006/07/03 16:56:16 UTC
Re: Correct handling of decoded data
On Jun 30, 2006, at 4:52 AM, Michael Bauroth wrote:
> Assume that I have a protocol, which contains some embedded key-
> value pairs. The current implemented behaviour decodes this data,
> convert it to POJO's and forwards it to the SessionHandler, where
> the data then is processed further. The disadvantage of this
> handling is, that I need for each key-value pair at least 1 POJO
> class (and have much construct - destroy - garbage collect + data
> streaming stuff).
>
> Now my question: What do you think from the Mina design point-of-
> view about the following solution? I decode the key-value pairs in
> my decoders, store it in the related session hash map and don't
> forward any ProtocolDecoderOutput to the handler. Only when some
> data is disrupted or the whole message is received, the decoder
> "fires" a "message completed" info over the ProtocolDecoderOutput
> to the handler, so that the handler can process the data, which
> were previously stored in the session.
You could certainly do this.
Just because your filter gets a 'messageReceived' event, it does not
mean that it has to pass the message on. Its perfectly valid to batch
messageReceive events in your filter until you have a more 'complete'
message, and only then pass it on down the filter chain.
-pete
--
proyal@apache.org - http://fotap.org/~osi