Spring AMQP

org.springframework.amqp.rabbit.connection
Class RabbitUtils

java.lang.Object
  extended by org.springframework.amqp.rabbit.connection.RabbitUtils

public abstract class RabbitUtils
extends Object

Author:
Mark Fisher, Mark Pollack

Field Summary
static int DEFAULT_PORT
           
 
Constructor Summary
RabbitUtils()
           
 
Method Summary
static void closeChannel(com.rabbitmq.client.Channel channel)
          Close the given RabbitMQ Channel and ignore any thrown exception.
static void closeConnection(Connection connection)
          Close the given RabbitMQ Connection and ignore any thrown exception.
static void closeMessageConsumer(com.rabbitmq.client.Channel channel, String consumerTag, boolean transactional)
           
static void commitIfNecessary(com.rabbitmq.client.Channel channel)
          Commit the Channel if not within a JTA transaction.
static RuntimeException convertRabbitAccessException(Throwable ex)
           
static void declareTransactional(com.rabbitmq.client.Channel channel)
          Declare to that broker that a channel is going to be used transactionally, and convert exceptions that arise.
static void rollbackIfNecessary(com.rabbitmq.client.Channel channel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

RabbitUtils

public RabbitUtils()
Method Detail

closeConnection

public static void closeConnection(Connection connection)
Close the given RabbitMQ Connection and ignore any thrown exception. This is useful for typical finally blocks in manual RabbitMQ code.

Parameters:
connection - the RabbitMQ Connection to close (may be null)

closeChannel

public static void closeChannel(com.rabbitmq.client.Channel channel)
Close the given RabbitMQ Channel and ignore any thrown exception. This is useful for typical finally blocks in manual RabbitMQ code.

Parameters:
channel - the RabbitMQ Channel to close (may be null)

commitIfNecessary

public static void commitIfNecessary(com.rabbitmq.client.Channel channel)
Commit the Channel if not within a JTA transaction.

Parameters:
channel - the RabbitMQ Channel to commit

rollbackIfNecessary

public static void rollbackIfNecessary(com.rabbitmq.client.Channel channel)

convertRabbitAccessException

public static RuntimeException convertRabbitAccessException(Throwable ex)

closeMessageConsumer

public static void closeMessageConsumer(com.rabbitmq.client.Channel channel,
                                        String consumerTag,
                                        boolean transactional)

declareTransactional

public static void declareTransactional(com.rabbitmq.client.Channel channel)
Declare to that broker that a channel is going to be used transactionally, and convert exceptions that arise.

Parameters:
channel - the channel to use

Spring AMQP

Copyright © 2011. All Rights Reserved.