public abstract class RabbitUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT |
Constructor and Description |
---|
RabbitUtils() |
Modifier and Type | Method and Description |
---|---|
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 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 boolean |
isPhysicalCloseRequired()
Gets and removes a ThreadLocal indicating the channel MUST be physically closed.
|
static void |
rollbackIfNecessary(com.rabbitmq.client.Channel channel) |
static void |
setPhysicalCloseRequired(boolean b)
Sets a ThreadLocal indicating the channel MUST be physically closed.
|
public static final int DEFAULT_PORT
public static void closeConnection(Connection connection)
finally
blocks in manual RabbitMQ code.connection
- the RabbitMQ Connection to close (may be null
)public static void closeChannel(com.rabbitmq.client.Channel channel)
finally
blocks in manual RabbitMQ code.channel
- the RabbitMQ Channel to close (may be null
)public static void commitIfNecessary(com.rabbitmq.client.Channel channel)
channel
- the RabbitMQ Channel to commitpublic static void rollbackIfNecessary(com.rabbitmq.client.Channel channel)
public static void closeMessageConsumer(com.rabbitmq.client.Channel channel, String consumerTag, boolean transactional)
public static void declareTransactional(com.rabbitmq.client.Channel channel)
channel
- the channel to usepublic static void setPhysicalCloseRequired(boolean b)
b
- public static boolean isPhysicalCloseRequired()