public class SimpleConnection extends Object implements Connection, com.rabbitmq.client.impl.NetworkConnection
Constructor and Description |
---|
SimpleConnection(com.rabbitmq.client.Connection delegate,
int closeTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
addBlockedListener(com.rabbitmq.client.BlockedListener listener)
Add a
BlockedListener . |
void |
close()
Close this connection and all its channels
with the
AMQP.REPLY_SUCCESS close code
and message 'OK'. |
com.rabbitmq.client.Channel |
createChannel(boolean transactional)
Create a new channel, using an internally allocated channel number.
|
InetAddress |
getAddress() |
com.rabbitmq.client.Connection |
getDelegate()
Return the underlying RabbitMQ connection.
|
InetAddress |
getLocalAddress() |
int |
getLocalPort() |
int |
getPort() |
boolean |
isOpen()
True if the connection is open.
|
boolean |
removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
Remove a
BlockedListener . |
String |
toString() |
public SimpleConnection(com.rabbitmq.client.Connection delegate, int closeTimeout)
public com.rabbitmq.client.Channel createChannel(boolean transactional)
Connection
createChannel
in interface Connection
transactional
- true if the channel should support transactionspublic void close()
Connection
AMQP.REPLY_SUCCESS
close code
and message 'OK'.
Waits for all the close operations to complete.close
in interface AutoCloseable
close
in interface Connection
public boolean isOpen()
isOpen
in interface Connection
AutoRecoverConnectionNotCurrentlyOpenException
- if the connection is an
AutorecoveringConnection
and is currently closed; this is required to
prevent the CachingConnectionFactory
from discarding this connection
and opening a new one, in which case the "old" connection would eventually be recovered
and orphaned - also any consumers belonging to it might be recovered too
and the broker will deliver messages to them when there is no code actually running
to deal with those messages (when using the SimpleMessageListenerContainer
).
If we have actually closed the connection
(e.g. via CachingConnectionFactory.resetConnection()
) this will return false.public int getLocalPort()
getLocalPort
in interface com.rabbitmq.client.impl.NetworkConnection
getLocalPort
in interface Connection
public void addBlockedListener(com.rabbitmq.client.BlockedListener listener)
Connection
BlockedListener
.addBlockedListener
in interface Connection
listener
- the listener to addConnection.addBlockedListener(BlockedListener)
public boolean removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
Connection
BlockedListener
.removeBlockedListener
in interface Connection
listener
- the listener to removetrue
if the listener was found and removed,
false
otherwiseConnection.removeBlockedListener(BlockedListener)
public InetAddress getLocalAddress()
getLocalAddress
in interface com.rabbitmq.client.impl.NetworkConnection
public InetAddress getAddress()
getAddress
in interface com.rabbitmq.client.impl.NetworkConnection
public int getPort()
getPort
in interface com.rabbitmq.client.impl.NetworkConnection
public com.rabbitmq.client.Connection getDelegate()
Connection
getDelegate
in interface Connection