Hi

I think you can create your own MINA codec (protocol) and you should have 
access to some kind of mina session object where you can close the session etc.

See for instance camel-hl7 that has a special MINA codec for HL7 data format.
http://activemq.apache.org/camel/hl7.html
And the source is here:
http://activemq.apache.org/camel/source.html


And of course MINA documentation as well
http://mina.apache.org/index.html
http://mina.apache.org/tutorial-on-protocolcodecfilter.html




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: jamie3 [mailto:[EMAIL PROTECTED] 
Sent: 22. oktober 2008 14:13
To: [email protected]
Subject: Closing mina:tcp socket?


I have situation where I have a system connecting to my Mina:tcp endpoint and
the system connected requires me to close the socket connection when I
receive a specific set of characters signaling an end of message. 

If I don't close the socket then the system connecting to me waits for an
un-specified amount of time (sometimes 5 minutes) before the socket is
closed at the system side. Once the socket is closed the system sends the
next message.

I don't want to close the server-side socket, but the connection to the
client. Thus, allowing multiple people to connect to the server
concurrently. Similar to an HTTP server.

My EIP is as follows:

                // aggregator for grouping the input from the tcp socket into a 
gold
message
                AggregationCollection ag = new PredicateAggregationCollection(
                                header("id"),
                                new MessageAggregator(),   // reads each line 
coming from the tcp socket
and aggregates it into a string object
                                new MessagePredicate()      // the comparator 
for determining when the
end of the message is found
                        );
                
                from("mina:tcp://localhost:2020?textline=true").
                        // tag the message id so the aggregator can pick it up
                        setHeader("id").exchange().
                        aggregator(ag).exchange().
                                choice().
                                
                                        // send tracks to message processor / 
correlator
                                        
when(header("id").isEqualTo("MyMessage")).
                                        // TODO need a way to send a
response back to mina and close the socket to the connected system
                                                to("mina:tcp://localhost:2030").
        
                                        // unsupported message
                                        otherwise().
                                                throwFault("Unsupported message 
id: " + header("id"));
                                                
Essentially I need a way to provide feedback to the from("mina:tcp....")
endpoint and tell it to close the socket for the specific system.

Is this even possible, and if so how can it be done?


-- 
View this message in context: 
http://www.nabble.com/Closing-mina%3Atcp-socket--tp20109426s22882p20109426.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to