Filter is the right place to do this things. There is a tutorial on
protocol encoders (special purpose filters) that shows how to
do the exact thing you are trying to achieve (i.e. you have a
messages with the length of it up-front available in the message
itself).

Take a look at the tutorial and see if you still have questions
after-wards. Here is the link:

http://mina.apache.org/tutorial-on-protocolcodecfilter.html

HTH,
Alex.

On Sat, Nov 28, 2009 at 6:32 AM, CS Wong <[email protected]> wrote:
> Hi,
>
> I'm trying to implement a TCP socket listener where an incoming request's
> payload look like "0234XXXXXXXXX.............." where the first 4 bytes
> indicates how many bytes to read in order to construct a complete message.
>
> Right now, I'm looking at message filters but it doesn't look like this is
> the right place. The "messageReceived()" method indicates that by the time a
> filter is invoked, the parser has already determined that a complete message
> has been received. Hence, I reckon I should be looking somewhere higher up
> the chain.
>
> According to the architecture diagram (
> http://mina.apache.org/mina-based-application-architecture.html) though,
> above the filter level, I'll be looking at IoSessions, and a look at classes
> such as NioSocketSession doesn't really look like it's the right place
> either.
>
> So I'd really appreciate just a simple pointer: where would be a good
> starting point for what I intend to do?
>
> Thanks!
> Wong
>

Reply via email to