What your call the 'backend' is in fact your application. Consider MINA as a part of it, and then the messageReceive will be able to invoke the part of the application that deal with the received XML

The easiest way to do that is to have a class in your application that extends the IoHandler interface : it will handle the messageReceived event.


Aleksandar Lazic wrote:
Dear list member,

I need do develop a middleware which converts a textline protocol to a
xml-protocol.

The first part is done.
Receiving the textline protocol
(ProtocolCodecFilter(Textline,MyDecoder_based on Textline)).

Now I get the received message into my handler and need to send the data
to the backend.

I would like to limit the connnections to the backend as follows.

Psydocode
###
main(){
remote_session_object = new XML-Protocol(...);
IoAcceptor acceptor = new NioSocketAcceptor();
.
.
???.setAttribute("MyObject", remote_session_object);
.
.
acceptor.setHandler(MyHandler);
.
.
}

class MyHandler extends IoHandlerAdapter {
    @Override
    public void messageReceived(IoSession session, Object message) {
remote_session_object = (ML-Protocol) session.getAttribute("MyObject");
    }
}
###

So that I have one connection to the backend and get only the object.

I hope I have explained it understandable.

Please can anybody point me to the right javadoc or example ;-)

Many thanks

Aleks



--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to