Interface Connection
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
ConnectionProxy
- All Known Implementing Classes:
SimpleConnection
public interface Connection extends java.lang.AutoCloseable- Author:
- Dave Syer, Gary Russell, Artem Bilan
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddBlockedListener(com.rabbitmq.client.BlockedListener listener)Add aBlockedListener.voidclose()Close this connection and all its channels with theAMQP.REPLY_SUCCESSclose code and message 'OK'.default voidcloseThreadChannel()Close any channel associated with the current thread.com.rabbitmq.client.ChannelcreateChannel(boolean transactional)Create a new channel, using an internally allocated channel number.default com.rabbitmq.client.ConnectiongetDelegate()Return the underlying RabbitMQ connection.intgetLocalPort()booleanisOpen()Flag to indicate the status of the connection.booleanremoveBlockedListener(com.rabbitmq.client.BlockedListener listener)Remove aBlockedListener.
-
-
-
Method Detail
-
createChannel
com.rabbitmq.client.Channel createChannel(boolean transactional) throws AmqpExceptionCreate 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
void close() throws AmqpExceptionClose this connection and all its channels with theAMQP.REPLY_SUCCESSclose code and message 'OK'. Waits for all the close operations to complete.- Specified by:
closein interfacejava.lang.AutoCloseable- 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:
Connection.addBlockedListener(BlockedListener)
-
removeBlockedListener
boolean removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
Remove aBlockedListener.- Parameters:
listener- the listener to remove- Returns:
trueif the listener was found and removed,falseotherwise- Since:
- 2.0
- See Also:
Connection.removeBlockedListener(BlockedListener)
-
getDelegate
@Nullable default 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.
-
-