camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamie3 <james.archib...@gdcanada.com>
Subject Closing mina:tcp socket?
Date Wed, 22 Oct 2008 12:12:59 GMT

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.


Mime
View raw message