Ian
Ian

Reputation: 711

How to get the Socket object from Mule TcpConnector

I want to close the socket once I get an exception during a persistent tcp connection (SendSocketOpen is set to true). Currently I believe Mule does not do the clean up for me, it simply releases the socket which means it is returning it to the pool.

Upvotes: 1

Views: 635

Answers (1)

David Dossot
David Dossot

Reputation: 33413

For the record, Unless you have keepSendSocketOpen (not SendSocketOpen as you posted) set to true on the connector or the endpoint, Mule will close the socket when returning it the sockets pool. If you forcefully close the socket, Mule should recover because it validates sockets when it takes one from the pool. So Mule should detect it's been closed and recreate it.

The problem is indeed to get a hold of the socket: AFAICS the only option is to extend org.mule.transport.tcp.TcpMessageDispatcher and configure the connector with a service-overrides child element that provides a TcpMessageDispatcherFactory that builds your own flavour of the dispatcher.

Upvotes: 2

Related Questions