You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Yogs <ym...@gemstone.com> on 2007/04/11 21:36:24 UTC

How can I configure multiple decoders in MINA?

Hi, 

Can I register more than one Encoders and Decoders to ProtocolCodecFactory
which is extended from mina’s DemuxingProtocolCodecFactory? 
Or we can have only one decoder and encoder registered as demonstrated in
SumUp example? 
How can I configure multiple decoders in MINA?


Thanks in Advance 

Regards,
Yogs

-- 
View this message in context: http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a9946908
Sent from the mina dev mailing list archive at Nabble.com.


Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
2007/5/20, Alwyn Schoeman <al...@gmail.com>:

>
> I agree with mat-29.
>
> In order for DemuxingProtocolCodecFactory to call a specific Decoder or
> Encoder, it will need to know what the type of the message is.
>
> Question is, how does it know?


I believe the only solution is to use IF ELSE in decoder class. If head
indicates protocol A -> return a Object A.

Does it assume a specific value at a specific offset in the data stream?
>
> Does it call all the Decoders in sequence until a Decoder acknowledges
> that
> it is meant for it?  (Hope not)
>
> Can you specify the matching logic in the extending class?
>
> Assume you have to handle different messages from different established
> protocols (cannot redesign), how would you handle that?
>
>
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10699327
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
Hi Alwyn,

Did you get what Trustin explain?


2007/5/20, Alwyn Schoeman <al...@gmail.com>:
>
>
> I agree with mat-29.
>
> In order for DemuxingProtocolCodecFactory to call a specific Decoder or
> Encoder, it will need to know what the type of the message is.
>
> Question is, how does it know?
>
> Does it assume a specific value at a specific offset in the data stream?
>
> Does it call all the Decoders in sequence until a Decoder acknowledges
> that
> it is meant for it?  (Hope not)
>
> Can you specify the matching logic in the extending class?
>
> Assume you have to handle different messages from different established
> protocols (cannot redesign), how would you handle that?
>
>
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10699327
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: How can I configure multiple decoders in MINA?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Alwyn,

On 5/20/07, Alwyn Schoeman <al...@gmail.com> wrote:
>
> I agree with mat-29.
>
> In order for DemuxingProtocolCodecFactory to call a specific Decoder or
> Encoder, it will need to know what the type of the message is.

Each MessageDecoder can determine if the incoming data is for itself
or not.  DemuxingProtocolCodecFactory calls MessageDecoder.decodable()
to find an appripriate MessageDecoder.

> Question is, how does it know?

It calls decodable() of all registered MessageDecoders.

> Does it assume a specific value at a specific offset in the data stream?

No.  Your MessageDecoder.decodable() decides.

> Does it call all the Decoders in sequence until a Decoder acknowledges that
> it is meant for it?  (Hope not)

Yes, but it doesn't perform that bad.

> Assume you have to handle different messages from different established
> protocols (cannot redesign), how would you handle that?

If those protocols are all implemented with
DemuxingProtocolCodecFactory, you can register all MessageDecoder
implementations and that's all.  If you want to disable all
MessageDecoders from one protocol once a message from the other
protocol is received, you can take care of it in your IoHandler
implementation.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: How can I configure multiple decoders in MINA?

Posted by Alwyn Schoeman <al...@gmail.com>.
I agree with mat-29.

In order for DemuxingProtocolCodecFactory to call a specific Decoder or
Encoder, it will need to know what the type of the message is.

Question is, how does it know?

Does it assume a specific value at a specific offset in the data stream? 

Does it call all the Decoders in sequence until a Decoder acknowledges that
it is meant for it?  (Hope not)

Can you specify the matching logic in the extending class?

Assume you have to handle different messages from different established
protocols (cannot redesign), how would you handle that?



-- 
View this message in context: http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10699327
Sent from the mina dev mailing list archive at Nabble.com.


Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
I still can't configure out this issue. Anyone can help me? Thanks a lot.

2007/4/27, mat <fo...@gmail.com>:
>
> Actually I did the same way by following mina SumUp example. If the server
> is used for different protocol(single protocol), it is very portable and I
> only need to figure the setup file to use the protocol on the fly. However,
> my GW has multiple protocols. I can't figure out how to implement my decoder
> classes since in FirstMessageDecoder I don't know what type protocol it is
> unless I decode the head of my message.
>
>
> 2007/4/26, Roman Magarshak <rm...@nds.com>:
> >
> > Not quite.
> > main:
> > IoAcceptor acceptor = new SocketAcceptor();
> > SocketAcceptorConfig cfg = new SocketAcceptorConfig();
> > DemuxingProtocolCodecFactory dpcf=new DemuxingProtocolCodecFactory();
> > dpcf.register(FirstMessageEncoder.class);
> > dpcf.register(SecondMessageEncoder.class);
> > cfg.getFilterChain().addLast("codec",new ProtocolCodecFilter( dpcf) );
> >
> > the Demuxing is done by by MINA
> >
> >
> >
> > On Thu, 2007-04-26 at 00:44 +0800, mat wrote:
> > > OK. Let me give you a little bit more details and see if you can help
> > me
> > > out.
> > > I had a GW server which have to encode and decode 2 differents
> > > protocols(listening on one port). Now I implemented a protocol codec
> > filter
> > > to encode and decode extends AbstractMessageDecoder. However, in
> > decodeBody
> > > and encodeBody functions. I still HAVE to use IF ELSE to judge which
> > > protocols according to heads of my protocols. I really can't figure
> > out how
> > > WITHOUT doing this.
> > >
> > >
> > > 2007/4/25, Yogs <ymahajan@gemstone.com >:
> > > >
> > > >
> > > > Yes Trustin is right, I am talking about
> > DemuxingProtocolCodecFactory
> > > >
> > > > You can pass an extra byte for message type and create a message
> > object,
> > > > decoder, encoder,handler per message type.
> > > > This will completely remove IF ELSE or SWITCH in your codec.
> > > >
> > > > It creates a lot of classes but its better than IF ELSE or SWITCH.
> > This
> > > > makes code maintainable. because in my blocking server
> > implementation, i
> > > > had
> > > > a dedicated serving thread on server and in its run method I had a
> > SWITCH
> > > > with multiple CASES. And the run method is now 2K lines of code, and
> > I
> > > > find
> > > > it difficult to maintain and difficult to add new message type in
> > the
> > > > system.
> > > >
> > > > So now in my non blocking implementation using MINA, I have Massage
> > > > Object,
> > > > Message Encoder, Message Decoder, and Message Handler per message
> > type. So
> > > > I
> > > > have added total 60 new classes, for my 15 different types of
> > messages.
> > > >
> > > > Does this make sense Trustin ? Is this the correct way to use MINA's
> >
> > > > DemuxingProtocolCodecFactory?
> > > >
> > > > Thanks in Advance
> > > >
> > > > Regards,
> > > > Yogs
> > > >
> > > >
> > > >
> > > >
> > > > mat-29 wrote:
> > > > >
> > > > > In my case, i have to use IF ELSE to judge which protocol, right?
> > > > >
> > > > > 2007/4/25, Trustin Lee <tr...@gmail.com>:
> > > > >>
> > > > >> On 4/25/07, mat <fo...@gmail.com> wrote:
> > > > >> > Really? However my server is listening on one port. How
> > > > messageDecoder
> > > > >> class
> > > > >> > knows different type of messages? Can you explain? Thanks.
> > > > >>
> > > > >> It seems like Yogs is talking about creating multiple
> > MessageDecoder
> > > > >> classes?  You can register multiple MessageDecoders and
> > > > >> MessageEncoders to DemuxingProtocolCodecFactory.
> > > > >>
> > > > >> HTH,
> > > > >> Trustin
> > > > >> --
> > > > >> what we call human nature is actually human habit
> > > > >> --
> > > > >> http://gleamynode.net/
> > > > >> --
> > > > >> PGP Key ID: 0x0255ECA6
> > > > >>
> > > > >
> > > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10183671
> > > > Sent from the mina dev mailing list archive at Nabble.com<http://nabble.com/>
> > .
> > > >
> > > >
> > --
> > Thank you in advance
> >        Roman.
> >
> > ***********************************************************************************
> > This email message and any attachments thereto are intended only for use
> > by the addressee(s) named above, and may contain legally privileged and/or
> > confidential information. If the reader of this message is not the intended
> > recipient, or the employee or agent responsible to deliver it to the
> > intended recipient, you are hereby notified that any dissemination,
> > distribution or copying of this communication is strictly prohibited. If you
> > have received this communication in error, please immediately notify the
> > postmaster@nds.com and destroy the original message.
> >
> > ***********************************************************************************
> >
>
>

Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
Actually I did the same way by following mina SumUp example. If the server
is used for different protocol(single protocol), it is very portable and I
only need to figure the setup file to use the protocol on the fly. However,
my GW has multiple protocols. I can't figure out how to implement my decoder
classes since in FirstMessageDecoder I don't know what type protocol it is
unless I decode the head of my message.


2007/4/26, Roman Magarshak <rm...@nds.com>:
>
> Not quite.
> main:
> IoAcceptor acceptor = new SocketAcceptor();
> SocketAcceptorConfig cfg = new SocketAcceptorConfig();
> DemuxingProtocolCodecFactory dpcf=new DemuxingProtocolCodecFactory();
> dpcf.register(FirstMessageEncoder.class);
> dpcf.register(SecondMessageEncoder.class);
> cfg.getFilterChain().addLast("codec",new ProtocolCodecFilter( dpcf) );
>
> the Demuxing is done by by MINA
>
>
>
> On Thu, 2007-04-26 at 00:44 +0800, mat wrote:
> > OK. Let me give you a little bit more details and see if you can help me
> > out.
> > I had a GW server which have to encode and decode 2 differents
> > protocols(listening on one port). Now I implemented a protocol codec
> filter
> > to encode and decode extends AbstractMessageDecoder. However, in
> decodeBody
> > and encodeBody functions. I still HAVE to use IF ELSE to judge which
> > protocols according to heads of my protocols. I really can't figure out
> how
> > WITHOUT doing this.
> >
> >
> > 2007/4/25, Yogs <ym...@gemstone.com>:
> > >
> > >
> > > Yes Trustin is right, I am talking about DemuxingProtocolCodecFactory
> > >
> > > You can pass an extra byte for message type and create a message
> object,
> > > decoder, encoder,handler per message type.
> > > This will completely remove IF ELSE or SWITCH in your codec.
> > >
> > > It creates a lot of classes but its better than IF ELSE or SWITCH.
> This
> > > makes code maintainable. because in my blocking server implementation,
> i
> > > had
> > > a dedicated serving thread on server and in its run method I had a
> SWITCH
> > > with multiple CASES. And the run method is now 2K lines of code, and I
> > > find
> > > it difficult to maintain and difficult to add new message type in the
> > > system.
> > >
> > > So now in my non blocking implementation using MINA, I have Massage
> > > Object,
> > > Message Encoder, Message Decoder, and Message Handler per message
> type. So
> > > I
> > > have added total 60 new classes, for my 15 different types of
> messages.
> > >
> > > Does this make sense Trustin ? Is this the correct way to use MINA's
> > > DemuxingProtocolCodecFactory?
> > >
> > > Thanks in Advance
> > >
> > > Regards,
> > > Yogs
> > >
> > >
> > >
> > >
> > > mat-29 wrote:
> > > >
> > > > In my case, i have to use IF ELSE to judge which protocol, right?
> > > >
> > > > 2007/4/25, Trustin Lee <tr...@gmail.com>:
> > > >>
> > > >> On 4/25/07, mat <fo...@gmail.com> wrote:
> > > >> > Really? However my server is listening on one port. How
> > > messageDecoder
> > > >> class
> > > >> > knows different type of messages? Can you explain? Thanks.
> > > >>
> > > >> It seems like Yogs is talking about creating multiple
> MessageDecoder
> > > >> classes?  You can register multiple MessageDecoders and
> > > >> MessageEncoders to DemuxingProtocolCodecFactory.
> > > >>
> > > >> HTH,
> > > >> Trustin
> > > >> --
> > > >> what we call human nature is actually human habit
> > > >> --
> > > >> http://gleamynode.net/
> > > >> --
> > > >> PGP Key ID: 0x0255ECA6
> > > >>
> > > >
> > > >
> > >
> > > --
> > > View this message in context:
> > >
> http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10183671
> > > Sent from the mina dev mailing list archive at Nabble.com.
> > >
> > >
> --
> Thank you in advance
>        Roman.
>
> ***********************************************************************************
> This email message and any attachments thereto are intended only for use
> by the addressee(s) named above, and may contain legally privileged and/or
> confidential information. If the reader of this message is not the intended
> recipient, or the employee or agent responsible to deliver it to the
> intended recipient, you are hereby notified that any dissemination,
> distribution or copying of this communication is strictly prohibited. If you
> have received this communication in error, please immediately notify the
> postmaster@nds.com and destroy the original message.
>
> ***********************************************************************************
>

Re: How can I configure multiple decoders in MINA?

Posted by Roman Magarshak <rm...@nds.com>.
Not quite.
main:
IoAcceptor acceptor = new SocketAcceptor();
SocketAcceptorConfig cfg = new SocketAcceptorConfig();
DemuxingProtocolCodecFactory dpcf=new DemuxingProtocolCodecFactory();
dpcf.register(FirstMessageEncoder.class);
dpcf.register(SecondMessageEncoder.class);
cfg.getFilterChain().addLast("codec",new ProtocolCodecFilter( dpcf) );

the Demuxing is done by by MINA



On Thu, 2007-04-26 at 00:44 +0800, mat wrote:
> OK. Let me give you a little bit more details and see if you can help me
> out.
> I had a GW server which have to encode and decode 2 differents
> protocols(listening on one port). Now I implemented a protocol codec filter
> to encode and decode extends AbstractMessageDecoder. However, in decodeBody
> and encodeBody functions. I still HAVE to use IF ELSE to judge which
> protocols according to heads of my protocols. I really can't figure out how
> WITHOUT doing this.
> 
> 
> 2007/4/25, Yogs <ym...@gemstone.com>:
> >
> >
> > Yes Trustin is right, I am talking about DemuxingProtocolCodecFactory
> >
> > You can pass an extra byte for message type and create a message object,
> > decoder, encoder,handler per message type.
> > This will completely remove IF ELSE or SWITCH in your codec.
> >
> > It creates a lot of classes but its better than IF ELSE or SWITCH. This
> > makes code maintainable. because in my blocking server implementation, i
> > had
> > a dedicated serving thread on server and in its run method I had a SWITCH
> > with multiple CASES. And the run method is now 2K lines of code, and I
> > find
> > it difficult to maintain and difficult to add new message type in the
> > system.
> >
> > So now in my non blocking implementation using MINA, I have Massage
> > Object,
> > Message Encoder, Message Decoder, and Message Handler per message type. So
> > I
> > have added total 60 new classes, for my 15 different types of messages.
> >
> > Does this make sense Trustin ? Is this the correct way to use MINA's
> > DemuxingProtocolCodecFactory?
> >
> > Thanks in Advance
> >
> > Regards,
> > Yogs
> >
> >
> >
> >
> > mat-29 wrote:
> > >
> > > In my case, i have to use IF ELSE to judge which protocol, right?
> > >
> > > 2007/4/25, Trustin Lee <tr...@gmail.com>:
> > >>
> > >> On 4/25/07, mat <fo...@gmail.com> wrote:
> > >> > Really? However my server is listening on one port. How
> > messageDecoder
> > >> class
> > >> > knows different type of messages? Can you explain? Thanks.
> > >>
> > >> It seems like Yogs is talking about creating multiple MessageDecoder
> > >> classes?  You can register multiple MessageDecoders and
> > >> MessageEncoders to DemuxingProtocolCodecFactory.
> > >>
> > >> HTH,
> > >> Trustin
> > >> --
> > >> what we call human nature is actually human habit
> > >> --
> > >> http://gleamynode.net/
> > >> --
> > >> PGP Key ID: 0x0255ECA6
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10183671
> > Sent from the mina dev mailing list archive at Nabble.com.
> >
> >
-- 
Thank you in advance
        Roman.
***********************************************************************************
This email message and any attachments thereto are intended only for use by the addressee(s) named above, and may contain legally privileged and/or confidential information. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster@nds.com and destroy the original message.
***********************************************************************************

Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
OK. Let me give you a little bit more details and see if you can help me
out.
I had a GW server which have to encode and decode 2 differents
protocols(listening on one port). Now I implemented a protocol codec filter
to encode and decode extends AbstractMessageDecoder. However, in decodeBody
and encodeBody functions. I still HAVE to use IF ELSE to judge which
protocols according to heads of my protocols. I really can't figure out how
WITHOUT doing this.


2007/4/25, Yogs <ym...@gemstone.com>:
>
>
> Yes Trustin is right, I am talking about DemuxingProtocolCodecFactory
>
> You can pass an extra byte for message type and create a message object,
> decoder, encoder,handler per message type.
> This will completely remove IF ELSE or SWITCH in your codec.
>
> It creates a lot of classes but its better than IF ELSE or SWITCH. This
> makes code maintainable. because in my blocking server implementation, i
> had
> a dedicated serving thread on server and in its run method I had a SWITCH
> with multiple CASES. And the run method is now 2K lines of code, and I
> find
> it difficult to maintain and difficult to add new message type in the
> system.
>
> So now in my non blocking implementation using MINA, I have Massage
> Object,
> Message Encoder, Message Decoder, and Message Handler per message type. So
> I
> have added total 60 new classes, for my 15 different types of messages.
>
> Does this make sense Trustin ? Is this the correct way to use MINA's
> DemuxingProtocolCodecFactory?
>
> Thanks in Advance
>
> Regards,
> Yogs
>
>
>
>
> mat-29 wrote:
> >
> > In my case, i have to use IF ELSE to judge which protocol, right?
> >
> > 2007/4/25, Trustin Lee <tr...@gmail.com>:
> >>
> >> On 4/25/07, mat <fo...@gmail.com> wrote:
> >> > Really? However my server is listening on one port. How
> messageDecoder
> >> class
> >> > knows different type of messages? Can you explain? Thanks.
> >>
> >> It seems like Yogs is talking about creating multiple MessageDecoder
> >> classes?  You can register multiple MessageDecoders and
> >> MessageEncoders to DemuxingProtocolCodecFactory.
> >>
> >> HTH,
> >> Trustin
> >> --
> >> what we call human nature is actually human habit
> >> --
> >> http://gleamynode.net/
> >> --
> >> PGP Key ID: 0x0255ECA6
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10183671
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: How can I configure multiple decoders in MINA?

Posted by Yogs <ym...@gemstone.com>.
Yes Trustin is right, I am talking about DemuxingProtocolCodecFactory

You can pass an extra byte for message type and create a message object,
decoder, encoder,handler per message type. 
This will completely remove IF ELSE or SWITCH in your codec.

It creates a lot of classes but its better than IF ELSE or SWITCH. This
makes code maintainable. because in my blocking server implementation, i had
a dedicated serving thread on server and in its run method I had a SWITCH
with multiple CASES. And the run method is now 2K lines of code, and I find
it difficult to maintain and difficult to add new message type in the
system. 

So now in my non blocking implementation using MINA, I have Massage Object,
Message Encoder, Message Decoder, and Message Handler per message type. So I
have added total 60 new classes, for my 15 different types of messages. 

Does this make sense Trustin ? Is this the correct way to use MINA's
DemuxingProtocolCodecFactory?

Thanks in Advance 

Regards,
Yogs




mat-29 wrote:
> 
> In my case, i have to use IF ELSE to judge which protocol, right?
> 
> 2007/4/25, Trustin Lee <tr...@gmail.com>:
>>
>> On 4/25/07, mat <fo...@gmail.com> wrote:
>> > Really? However my server is listening on one port. How messageDecoder
>> class
>> > knows different type of messages? Can you explain? Thanks.
>>
>> It seems like Yogs is talking about creating multiple MessageDecoder
>> classes?  You can register multiple MessageDecoders and
>> MessageEncoders to DemuxingProtocolCodecFactory.
>>
>> HTH,
>> Trustin
>> --
>> what we call human nature is actually human habit
>> --
>> http://gleamynode.net/
>> --
>> PGP Key ID: 0x0255ECA6
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10183671
Sent from the mina dev mailing list archive at Nabble.com.


Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
In my case, i have to use IF ELSE to judge which protocol, right?

2007/4/25, Trustin Lee <tr...@gmail.com>:
>
> On 4/25/07, mat <fo...@gmail.com> wrote:
> > Really? However my server is listening on one port. How messageDecoder
> class
> > knows different type of messages? Can you explain? Thanks.
>
> It seems like Yogs is talking about creating multiple MessageDecoder
> classes?  You can register multiple MessageDecoders and
> MessageEncoders to DemuxingProtocolCodecFactory.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>

Re: How can I configure multiple decoders in MINA?

Posted by Trustin Lee <tr...@gmail.com>.
On 4/25/07, mat <fo...@gmail.com> wrote:
> Really? However my server is listening on one port. How messageDecoder class
> knows different type of messages? Can you explain? Thanks.

It seems like Yogs is talking about creating multiple MessageDecoder
classes?  You can register multiple MessageDecoders and
MessageEncoders to DemuxingProtocolCodecFactory.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
Really? However my server is listening on one port. How messageDecoder class
knows different type of messages? Can you explain? Thanks.

2007/4/25, Yogs <ym...@gemstone.com>:
>
>
> Hi,
>
> I am able to register multiple encoders/decoders.
>
> my server is expected to recieve different type of messages. I have
> implemented deocdable() method of my each decoder according to message
> type
> of the message. so u wont need any IF ELSE structure in your deocder.
>
> Regards,
> Yogs
>
>
>
> mat-29 wrote:
> >
> > What i meants was needed to add more "IF else" into message decoder(NOT
> > good
> > design pattern)?
> >
> > 2007/4/22, mat <fo...@gmail.com>:
> >>
> >> Actually i had same questions, I am implementing a Gateway proxy server
> >> which should understand 2 different protocols. Should I use IF ELSE
> >> method
> >> in my own message decoder class? However, I don't think it is a good
> >> approach since it prevents adding new protocols. Any good idea?
> >>
> >> 2007/4/17, Trustin Lee <tr...@gmail.com>:
> >> >
> >> > Hi Yogs,
> >> >
> >> > On 4/12/07, Yogs <ym...@gemstone.com> wrote:
> >> > >
> >> > > Hi,
> >> > >
> >> > > Can I register more than one Encoders and Decoders to
> >> > ProtocolCodecFactory
> >> > > which is extended from mina's DemuxingProtocolCodecFactory?
> >> > > Or we can have only one decoder and encoder registered as
> >> demonstrated
> >> > in
> >> > > SumUp example?
> >> > > How can I configure multiple decoders in MINA?
> >> >
> >> > Could you explain the protocol you want to implement more in detail?
> >> > Do you just want to merge two codecs into one, or to implement
> >> > multi-layered protocol?
> >> >
> >> > Trustin
> >> > --
> >> > what we call human nature is actually human habit
> >> > --
> >> > http://gleamynode.net/
> >> > --
> >> > PGP Key ID: 0x0255ECA6
> >> >
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10175213
> Sent from the mina dev mailing list archive at Nabble.com.
>
>

Re: How can I configure multiple decoders in MINA?

Posted by Yogs <ym...@gemstone.com>.
Hi, 

I am able to register multiple encoders/decoders. 

my server is expected to recieve different type of messages. I have
implemented deocdable() method of my each decoder according to message type
of the message. so u wont need any IF ELSE structure in your deocder. 

Regards,
Yogs



mat-29 wrote:
> 
> What i meants was needed to add more "IF else" into message decoder(NOT
> good
> design pattern)?
> 
> 2007/4/22, mat <fo...@gmail.com>:
>>
>> Actually i had same questions, I am implementing a Gateway proxy server
>> which should understand 2 different protocols. Should I use IF ELSE
>> method
>> in my own message decoder class? However, I don't think it is a good
>> approach since it prevents adding new protocols. Any good idea?
>>
>> 2007/4/17, Trustin Lee <tr...@gmail.com>:
>> >
>> > Hi Yogs,
>> >
>> > On 4/12/07, Yogs <ym...@gemstone.com> wrote:
>> > >
>> > > Hi,
>> > >
>> > > Can I register more than one Encoders and Decoders to
>> > ProtocolCodecFactory
>> > > which is extended from mina's DemuxingProtocolCodecFactory?
>> > > Or we can have only one decoder and encoder registered as
>> demonstrated
>> > in
>> > > SumUp example?
>> > > How can I configure multiple decoders in MINA?
>> >
>> > Could you explain the protocol you want to implement more in detail?
>> > Do you just want to merge two codecs into one, or to implement
>> > multi-layered protocol?
>> >
>> > Trustin
>> > --
>> > what we call human nature is actually human habit
>> > --
>> > http://gleamynode.net/
>> > --
>> > PGP Key ID: 0x0255ECA6
>> >
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-configure-multiple-decoders-in-MINA--tf3561571.html#a10175213
Sent from the mina dev mailing list archive at Nabble.com.


Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
What i meants was needed to add more "IF else" into message decoder(NOT good
design pattern)?

2007/4/22, mat <fo...@gmail.com>:
>
> Actually i had same questions, I am implementing a Gateway proxy server
> which should understand 2 different protocols. Should I use IF ELSE method
> in my own message decoder class? However, I don't think it is a good
> approach since it prevents adding new protocols. Any good idea?
>
> 2007/4/17, Trustin Lee <tr...@gmail.com>:
> >
> > Hi Yogs,
> >
> > On 4/12/07, Yogs <ym...@gemstone.com> wrote:
> > >
> > > Hi,
> > >
> > > Can I register more than one Encoders and Decoders to
> > ProtocolCodecFactory
> > > which is extended from mina's DemuxingProtocolCodecFactory?
> > > Or we can have only one decoder and encoder registered as demonstrated
> > in
> > > SumUp example?
> > > How can I configure multiple decoders in MINA?
> >
> > Could you explain the protocol you want to implement more in detail?
> > Do you just want to merge two codecs into one, or to implement
> > multi-layered protocol?
> >
> > Trustin
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
>
>

Re: How can I configure multiple decoders in MINA?

Posted by mat <fo...@gmail.com>.
Actually i had same questions, I am implementing a Gateway proxy server
which should understand 2 different protocols. Should I use IF ELSE method
in my own message decoder class? However, I don't think it is a good
approach since it prevents adding new protocols. Any good idea?

2007/4/17, Trustin Lee <tr...@gmail.com>:
>
> Hi Yogs,
>
> On 4/12/07, Yogs <ym...@gemstone.com> wrote:
> >
> > Hi,
> >
> > Can I register more than one Encoders and Decoders to
> ProtocolCodecFactory
> > which is extended from mina's DemuxingProtocolCodecFactory?
> > Or we can have only one decoder and encoder registered as demonstrated
> in
> > SumUp example?
> > How can I configure multiple decoders in MINA?
>
> Could you explain the protocol you want to implement more in detail?
> Do you just want to merge two codecs into one, or to implement
> multi-layered protocol?
>
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>

Re: How can I configure multiple decoders in MINA?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Yogs,

On 4/12/07, Yogs <ym...@gemstone.com> wrote:
>
> Hi,
>
> Can I register more than one Encoders and Decoders to ProtocolCodecFactory
> which is extended from mina's DemuxingProtocolCodecFactory?
> Or we can have only one decoder and encoder registered as demonstrated in
> SumUp example?
> How can I configure multiple decoders in MINA?

Could you explain the protocol you want to implement more in detail?
Do you just want to merge two codecs into one, or to implement
multi-layered protocol?

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6