Interface Connection
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
ConnectionProxy
- All Known Implementing Classes:
SimpleConnection
- Author:
- Dave Syer, Gary Russell, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlockedListener
(com.rabbitmq.client.BlockedListener listener) Add aBlockedListener
.void
close()
Close this connection and all its channels with theAMQP.REPLY_SUCCESS
close code and message 'OK'.default void
Close any channel associated with the current thread.com.rabbitmq.client.Channel
createChannel
(boolean transactional) Create a new channel, using an internally allocated channel number.com.rabbitmq.client.Connection
Return the underlying RabbitMQ connection.int
boolean
isOpen()
Flag to indicate the status of the connection.boolean
removeBlockedListener
(com.rabbitmq.client.BlockedListener listener) Remove aBlockedListener
.
-
Method Details
-
createChannel
Create a new channel, using an internally allocated channel number.- Parameters:
transactional
- true if the channel should support transactions- Returns:
- a new channel descriptor, or null if none is available
- Throws:
AmqpException
- if an I/O problem is encountered
-
close
Close this connection and all its channels with theAMQP.REPLY_SUCCESS
close code and message 'OK'.Waits for all the close operations to complete.
- Specified by:
close
in interfaceAutoCloseable
- Throws:
AmqpException
- if an I/O problem is encountered
-
isOpen
boolean isOpen()Flag to indicate the status of the connection.- Returns:
- true if the connection is open
-
getLocalPort
int getLocalPort()- Returns:
- the local port if the underlying connection supports it.
-
addBlockedListener
void addBlockedListener(com.rabbitmq.client.BlockedListener listener) Add aBlockedListener
.- Parameters:
listener
- the listener to add- Since:
- 2.0
- See Also:
-
removeBlockedListener
boolean removeBlockedListener(com.rabbitmq.client.BlockedListener listener) Remove aBlockedListener
.- Parameters:
listener
- the listener to remove- Returns:
true
if the listener was found and removed,false
otherwise- Since:
- 2.0
- See Also:
-
getDelegate
com.rabbitmq.client.Connection getDelegate()Return the underlying RabbitMQ connection.- Returns:
- the connection.
-
closeThreadChannel
default void closeThreadChannel()Close any channel associated with the current thread.
-