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 void
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
closeThreadChannel()
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.default com.rabbitmq.client.Connection
getDelegate()
Return the underlying RabbitMQ connection.int
getLocalPort()
boolean
isOpen()
Flag to indicate the status of the connection.boolean
removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
Remove aBlockedListener
.
-
-
-
Method Detail
-
createChannel
com.rabbitmq.client.Channel createChannel(boolean transactional) throws AmqpException
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
void close() throws AmqpException
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 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:
true
if the listener was found and removed,false
otherwise- 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.
-
-