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.

 

 

 

Reply via email to