Package org.hobbit.core.rabbit
Class RabbitQueueFactoryImpl
java.lang.Object
org.hobbit.core.rabbit.RabbitQueueFactoryImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,RabbitQueueFactory
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()com.rabbitmq.client.ChannelThis method opens a channel using the established connection to RabbitMQ.This method opens a channel using the established connection to RabbitMQ and creates a new queue using the given name and the following configuration: The channel number is automatically derived from the connection. The queue is not durable. The queue is not exclusive. The queue is configured to be deleted automatically. No additional queue configuration is defined.createDefaultRabbitQueue(String name, com.rabbitmq.client.Channel channel) This method uses the given channel and creates a new queue using the given name and the following configuration: The queue is not durable. The queue is not exclusive. The queue is configured to be deleted automatically. No additional queue configuration is defined.com.rabbitmq.client.ConnectionReturns theConnectionto the RabbitMQ broker used internally.
-
Field Details
-
connection
private final com.rabbitmq.client.Connection connection
-
-
Constructor Details
-
RabbitQueueFactoryImpl
public RabbitQueueFactoryImpl(com.rabbitmq.client.Connection connection)
-
-
Method Details
-
createDefaultRabbitQueue
Description copied from interface:RabbitQueueFactoryThis method opens a channel using the established connection to RabbitMQ and creates a new queue using the given name and the following configuration:- The channel number is automatically derived from the connection.
- The queue is not durable.
- The queue is not exclusive.
- The queue is configured to be deleted automatically.
- No additional queue configuration is defined.
- Specified by:
createDefaultRabbitQueuein interfaceRabbitQueueFactory- Parameters:
name- name of the queue- Returns:
RabbitQueueobject comprising theChanneland the name of the created queue- Throws:
IOException- if a communication problem during the creation of the channel or the queue occurs
-
getConnection
public com.rabbitmq.client.Connection getConnection()Description copied from interface:RabbitQueueFactoryReturns theConnectionto the RabbitMQ broker used internally.- Specified by:
getConnectionin interfaceRabbitQueueFactory- Returns:
- the
Connectionto the RabbitMQ broker used internally
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
createDefaultRabbitQueue
public RabbitQueue createDefaultRabbitQueue(String name, com.rabbitmq.client.Channel channel) throws IOException Description copied from interface:RabbitQueueFactoryThis method uses the given channel and creates a new queue using the given name and the following configuration:- The queue is not durable.
- The queue is not exclusive.
- The queue is configured to be deleted automatically.
- No additional queue configuration is defined.
- Specified by:
createDefaultRabbitQueuein interfaceRabbitQueueFactory- Parameters:
name- name of the queuechannel- theChannelthat will be used to generate the queue- Returns:
RabbitQueueobject comprising theChanneland the name of the created queue- Throws:
IOException- if a communication problem during the creation of the channel or the queue occurs
-
createChannel
Description copied from interface:RabbitQueueFactoryThis method opens a channel using the established connection to RabbitMQ. The channel number is automatically derived from the connection.- Specified by:
createChannelin interfaceRabbitQueueFactory- Returns:
- the newly created
Channel - Throws:
IOException- if a communication problem during the creation of the channel
-