You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Simon Trudeau <st...@bluetreewireless.com> on 2008/04/09 19:44:27 UTC
DemuxingIoHandler and IoHandlerChain
I am trying to forward a message to a specific filter or handler (witch
ever, I don't really mind at the moment) according to the message type.
How should I be doing that using mina. Currently I am using a
DemuxingProtocolCodecFactory to decode my received messages and it does
the job perfectly. I would like to add a second level of processing
(transform my messages again) according to the message type which would
output a common message result type, which would then be processed. I
know my explanations are not clear :.) My first tought would have been
to use a DemuxingIoHandler and an IoHandlerChain but I don't know how to
hook a DemuxingIoHandler to an IoHandlerChain since the IoHandlerChain
doesn't take IoHandler but IoHandlerCommands. Would any of you have an
idea?
Thanks,
Simon
Here's a diagram of my situation:
/transform b1 - transform b2\
msg - - transform 3
\transform a1 - transform a2/
RE: DemuxingIoHandler and IoHandlerChain
Posted by Simon Trudeau <st...@bluetreewireless.com>.
Thanks for the idea, sounds good. I did something a bit different. I used the same pattern as the demuxingIoFilter by implementing a strategy factory IoFilter which delegates processing to the appropriate "IoFilter" (a custom class with a method called handle(message) in my case! :.) according to the received message type. So far, it works pretty well. I guess that instead of delegating the processing to a single custom filter according to type, I could delegate to a chain of filters according to type! Maybe as a further enhancement...
Thanks again,
Simon
-----Original Message-----
From: "이희승 (Trustin Lee) [mailto:trustin@gmail.com]
Sent: April-20-08 1:27 AM
To: users@mina.apache.org
Subject: Re: DemuxingIoHandler and IoHandlerChain
Hi Simon,
I am sorry for being late. Was distracted by many things. :)
For now we don't provide such a feature due to its implementation complexity and possible confusion.
What do you think about inserting four custom filters?
msg - transform a1 - transform b1 - transform a2 - transform b2 - transform 3
You could program the transforming filters to ignore messages which is not relevant to it. For example, 'transform a1' and 'transform a2'
could ignore the message type B and just forward them to the next filter. How does it sound?
HTH,
Simon Trudeau wrote:
> I am trying to forward a message to a specific filter or handler
> (witch ever, I don't really mind at the moment) according to the message type.
> How should I be doing that using mina. Currently I am using a
> DemuxingProtocolCodecFactory to decode my received messages and it
> does the job perfectly. I would like to add a second level of
> processing (transform my messages again) according to the message type
> which would output a common message result type, which would then be
> processed. I know my explanations are not clear :.) My first tought
> would have been to use a DemuxingIoHandler and an IoHandlerChain but I
> don't know how to hook a DemuxingIoHandler to an IoHandlerChain since
> the IoHandlerChain doesn't take IoHandler but IoHandlerCommands. Would
> any of you have an idea?
>
> Thanks,
>
> Simon
>
> Here's a diagram of my situation:
>
>
> /transform b1 - transform b2\
> msg - - transform 3
> \transform a1 - transform a2/
>
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/
Re: DemuxingIoHandler and IoHandlerChain
Posted by 이희승 (Trustin Lee) <t...@gmail.com>.
Hi Simon,
I am sorry for being late. Was distracted by many things. :)
For now we don't provide such a feature due to its implementation
complexity and possible confusion.
What do you think about inserting four custom filters?
msg - transform a1 - transform b1 - transform a2 - transform b2 -
transform 3
You could program the transforming filters to ignore messages which is
not relevant to it. For example, 'transform a1' and 'transform a2'
could ignore the message type B and just forward them to the next
filter. How does it sound?
HTH,
Simon Trudeau wrote:
> I am trying to forward a message to a specific filter or handler (witch
> ever, I don't really mind at the moment) according to the message type.
> How should I be doing that using mina. Currently I am using a
> DemuxingProtocolCodecFactory to decode my received messages and it does
> the job perfectly. I would like to add a second level of processing
> (transform my messages again) according to the message type which would
> output a common message result type, which would then be processed. I
> know my explanations are not clear :.) My first tought would have been
> to use a DemuxingIoHandler and an IoHandlerChain but I don't know how to
> hook a DemuxingIoHandler to an IoHandlerChain since the IoHandlerChain
> doesn't take IoHandler but IoHandlerCommands. Would any of you have an
> idea?
>
> Thanks,
>
> Simon
>
> Here's a diagram of my situation:
>
>
> /transform b1 - transform b2\
> msg - - transform 3
> \transform a1 - transform a2/
>
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/