You could specify MessageHandler.NOOP in that case?

On Fri, 16 May 2008 20:35:06 +0900, arati <[EMAIL PROTECTED]> wrote:

Hi All,

I want server and client both to handle multiple messages.

For example say AddMessage, SubtractMessage, AddResultMessage and
SubtractResultMessage.

When client sends AddMessage it receives AddResultMessage and similar for
SubtractMessage.


I am using mina 2.0M1.

According to my understanding I need to write message, encoder, decoder and
handler classes for these messages.

As both the client and server should be able to handle different messages, I
have extended from

DemuxingIOHandler for client and server main handlers.

I have added the encoders and decoders to DemuxingProtocolCodecFactory and
added this to filter chain.

Now in these main handlers I need to add handlers for individual messages.


So that is done by:

In server side handler


addReceivedMessageHandler(AddMessage.class, new AddMessageHandler());

addReceivedMessageHandler(SubtractMessage.class, new
SubtractMessageHandler());

addSentMessageHandler(AddResultMessage.class, new
AddResultMessageHandler());

addSentMessageHandler(SubtractResultMessage.class, new
SubtractResultMessageHandler());


But on server side I don't want to do anything in the
Add/SubtractResultMessageHandler's handleMessage() method.

So is there any way to avoid adding these handlers?

If I don't add these handler then it gives exception.


On the client side also I need to do same thing.

There I don't want to use the Add/Subtract message handler's handleMessage()
method.


In general is there any way to avoid adding handlers for sent messages?

If not, then does that mean that I need to write different messageHandlers
for client and server for the same messages?


Thanks in advance.







--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Reply via email to