Example usage for com.rabbitmq.client Channel close

List of usage examples for com.rabbitmq.client Channel close

Introduction

In this page you can find the example usage for com.rabbitmq.client Channel close.

Prototype

void close(int closeCode, String closeMessage) throws IOException, TimeoutException;

Source Link

Document

Close this channel.

Usage

From source file:com.cisco.oss.foundation.message.ChannelWrapper.java

License:Apache License

protected static void closeChannelAndRemoveFromMap(Channel channel, String reason) {

    // Note: once channel was closed, any action on the object will result with AlreadyClosedException :(
    try {//  ww  w  .  j a  v  a  2  s  . co  m
        if (channel != null) {
            int channelNumber = channel.getChannelNumber();
            LOGGER.info("closeChannel " + channelNumber + " reason: " + reason);
            channel.close(200, reason);
            channels.remove(channelNumber);
        }
    } catch (IOException e) {
        e.printStackTrace();
    } catch (TimeoutException e) {
        e.printStackTrace();
    } catch (AlreadyClosedException e) {
        e.printStackTrace();
    }
}

From source file:org.ballerinalang.messaging.rabbitmq.util.ChannelUtils.java

License:Open Source License

/**
 * Closes the channel./*from w  w w . j a  v  a  2s .  com*/
 *
 * @param channel      RabbitMQ Channel object.
 * @param closeCode    The close code (See under "Reply Codes" in the AMQP specification).
 * @param closeMessage A message indicating the reason for closing the connection.
 * @throws IOException      If an I/O problem is encountered.
 * @throws TimeoutException Thrown the operation times out.
 */
public static void close(Channel channel, int closeCode, String closeMessage)
        throws IOException, TimeoutException {
    channel.close(closeCode, closeMessage);

}