How to forcedly close a broker side connection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to forcedly close a broker side connection

Eanbiso
Hi all,
I want to close the connections (ManagedTransportConnection) opened by a specific producer.
I've stored the ConnectionContext used to add the connection and, when I want to close the connection, I tried with:
context.getConnectionState().shutdown()
but the producer is still up and running,
and with:
context.getConnection().stop()
but I'm blocked on the operation waiting indefinitely.
Which is the correct way to close the connection and throw down all the producers so that they should make a new connection recalling the
addConnection(ConnectionContext context, ConnectionInfo info)
to send new data?
Thanks a lot,

Andrea
Reply | Threaded
Open this post in threaded view
|

Re: How to forcedly close a broker side connection

Eanbiso
I've tried with:
ManagedTransportConnection connM = (ManagedTransportConnection)(context.getConnection());
connM.processRemoveConnection(context.getConnectionId(), 0l);
and it seems to work: all the consumers and producers associated with the connection seem to be properly removed following the code via debugger.
Is this the right way to close the connection?

Andrea
Reply | Threaded
Open this post in threaded view
|

Re: How to forcedly close a broker side connection

artnaseef
How about ConnectionContext.getConnection().stop()?
Reply | Threaded
Open this post in threaded view
|

Re: How to forcedly close a broker side connection

Eanbiso
 I tried with:
context.getConnection().stop()
but I'm blocked on the operation waiting indefinitely.
The operation described in the previous post
.processRemoveConnection(context.getConnectionId(), 0l);
seems correct.