public abstract class AbstractComponent extends Object implements Component, RabbitQueueFactory
| Modifier and Type | Field and Description |
|---|---|
protected com.rabbitmq.client.ConnectionFactory |
connectionFactory
The factory that can be used to create additional connections.
|
protected com.rabbitmq.client.Connection |
dataConnection
The connection to the RabbitMQ broker.
|
private String |
hobbitSessionId |
private static org.slf4j.Logger |
LOGGER |
static int |
NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ
Maximum number of retries that are executed to connect to RabbitMQ.
|
protected String |
rabbitMQHostName
The host name of the RabbitMQ broker.
|
static long |
START_WAITING_TIME_BEFORE_RETRY
Time, the system waits before retrying to connect to RabbitMQ.
|
| Constructor and Description |
|---|
AbstractComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
RabbitQueue |
createDefaultRabbitQueue(String name)
This method opens a channel using the established
dataConnection
to RabbitMQ and creates a new queue using the given name and the
following configuration:
The channel number is automatically derived from the connection. |
String |
generateSessionQueueName(String queueName) |
String |
getHobbitSessionId() |
void |
init()
This method initializes the component.
|
private static final org.slf4j.Logger LOGGER
public static final int NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ
public static final long START_WAITING_TIME_BEFORE_RETRY
private String hobbitSessionId
protected com.rabbitmq.client.Connection dataConnection
protected String rabbitMQHostName
protected com.rabbitmq.client.ConnectionFactory connectionFactory
dataConnection.public void init()
throws Exception
Componentpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic String getHobbitSessionId()
public RabbitQueue createDefaultRabbitQueue(String name) throws IOException
dataConnection
to RabbitMQ and creates a new queue using the given name and the
following configuration:
createDefaultRabbitQueue in interface RabbitQueueFactoryname - name of the queueRabbitQueue object comprising the Channel and the
name of the created queueIOException - if a communication error occursCopyright © 2017. All rights reserved.