Interface Connection

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ConnectionProxy
All Known Implementing Classes:
SimpleConnection

public interface Connection extends AutoCloseable
Author:
Dave Syer, Gary Russell, Artem Bilan
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addBlockedListener(com.rabbitmq.client.BlockedListener listener)
    Add a BlockedListener.
    void
    Close this connection and all its channels with the AMQP.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.
    default com.rabbitmq.client.Connection
    Return the underlying RabbitMQ connection.
    int
     
    boolean
    Flag to indicate the status of the connection.
    boolean
    removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
    Remove a BlockedListener.
  • Method Details

    • 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 the AMQP.REPLY_SUCCESS close code and message 'OK'. Waits for all the close operations to complete.
      Specified by:
      close in interface 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 a BlockedListener.
      Parameters:
      listener - the listener to add
      Since:
      2.0
      See Also:
      • Connection.addBlockedListener(BlockedListener)
    • removeBlockedListener

      boolean removeBlockedListener(com.rabbitmq.client.BlockedListener listener)
      Remove a BlockedListener.
      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.