You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by amit mevada <am...@gmail.com> on 2015/07/03 13:38:18 UTC

Apache MINA TCP server fails to receiving some messages when more then two soruce sending messages concurrently

Apache mina TCP server its working fine when single user sending HL7
message using HAPPI Test panel(tool for sending HL7 messages).

*Its Working fine with # no of messages sent by HAPPI test panel*

*But When more then two user try to sent # of message concurrently then
some message not transmit by *

*HAPPI Test Panel , its give error*

Failed to transmit message. Time out waiting for response to message

------------------------------------------------
Peices of code===
-----------------------------------

private SocketAcceptor acceptor=new NioSocketAcceptor();
acceptor.getFilterChain().addLast("codec",new ProtocolCodecFilter(new
TextLineCodecFactory(Charset.forName("US-ASCII"))));
acceptor.getFilterChain().addLast("Messagefilter",new MessageFilter());
acceptor.setHandler("MyHandler",new MyHandler());
try {
acceptor.bind(new InetSocketAddress(portNo));
}
catch (  IOException ex) {
throw new RuntimeException("Couldnt bind to port: " + popPort,ex);
}

--------
MessageFilter class extends IoFilterAdapter and override the messageReceived
--------
@Override
public void messageReceived(NextFilter nextFilter, IoSession
session,Object message) throws Exception {

    System.out.prinln(message);
    ........ my simple stuff here.....
    nextFilter.messageReceived(session, strMsg);
}



--------

is there any configuration remaining ,Is this single thread and synchronous?
Why message are not receive concurrently when multiple sender sent
messages to same port?



-- 
Thanks & regards ,
Amit Mevada

Re: Apache MINA TCP server fails to receiving some messages when more then two soruce sending messages concurrently

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 03/07/15 13:38, amit mevada a écrit :
> Apache mina TCP server its working fine when single user sending HL7
> message using HAPPI Test panel(tool for sending HL7 messages).
>
> *Its Working fine with # no of messages sent by HAPPI test panel*
>
> *But When more then two user try to sent # of message concurrently then
> some message not transmit by *
>
> *HAPPI Test Panel , its give error*
>
> Failed to transmit message. Time out waiting for response to message
>
> ------------------------------------------------
> Peices of code===
> -----------------------------------
>
> private SocketAcceptor acceptor=new NioSocketAcceptor();
> acceptor.getFilterChain().addLast("codec",new ProtocolCodecFilter(new
> TextLineCodecFactory(Charset.forName("US-ASCII"))));
> acceptor.getFilterChain().addLast("Messagefilter",new MessageFilter());
> acceptor.setHandler("MyHandler",new MyHandler());
> try {
> acceptor.bind(new InetSocketAddress(portNo));
> }
> catch (  IOException ex) {
> throw new RuntimeException("Couldnt bind to port: " + popPort,ex);
> }
>
> --------
> MessageFilter class extends IoFilterAdapter and override the messageReceived
> --------
> @Override
> public void messageReceived(NextFilter nextFilter, IoSession
> session,Object message) throws Exception {
>
>     System.out.prinln(message);
>     ........ my simple stuff here.....
>     nextFilter.messageReceived(session, strMsg);
> }
>
>
>
> --------
>
> is there any configuration remaining ,Is this single thread and synchronous?
> Why message are not receive concurrently when multiple sender sent
> messages to same port?
>
>
>
The question is : how many connections to your server is the HAPPI
client opening ? If it opens one single connection that is shared across
many users, then you are screwed : all the messages will be handled by
one unique session, and at some point, due to TCP fragmentation, it's
likely that some messages will get garbled or intermixed.

You have to provide some more infos about how is your client working.