Package org.hobbit.core.components
Class AbstractComponent
- java.lang.Object
-
- org.hobbit.core.components.AbstractComponent
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Component
- Direct Known Subclasses:
AbstractCommandReceivingComponent
public abstract class AbstractComponent extends Object implements Component
This abstract class implements basic functionalities of a hobbit component.- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
-
Field Summary
Fields Modifier and Type Field Description protected com.rabbitmq.client.ConnectionFactoryconnectionFactoryThe factory that can be used to create additional connections.private StringhobbitSessionIdprotected RabbitQueueFactoryincomingDataQueueFactoryFactory for creating outgoing data queues.private static org.slf4j.LoggerLOGGERstatic intNUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQMaximum number of retries that are executed to connect to RabbitMQ.protected RabbitQueueFactoryoutgoingDataQueuefactoryFactory for creating outgoing data queues.protected StringrabbitMQHostNameThe host name of the RabbitMQ broker.static longSTART_WAITING_TIME_BEFORE_RETRYTime, the system waits before retrying to connect to RabbitMQ.
-
Constructor Summary
Constructors Constructor Description AbstractComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected com.rabbitmq.client.ConnectioncreateConnection()StringgenerateSessionQueueName(String queueName)StringgetHobbitSessionId()voidinit()This method initializes the component.
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ
public static final int NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ
Maximum number of retries that are executed to connect to RabbitMQ.- See Also:
- Constant Field Values
-
START_WAITING_TIME_BEFORE_RETRY
public static final long START_WAITING_TIME_BEFORE_RETRY
Time, the system waits before retrying to connect to RabbitMQ. Note that this time will be multiplied with the number of already failed tries.- See Also:
- Constant Field Values
-
hobbitSessionId
private String hobbitSessionId
-
outgoingDataQueuefactory
protected RabbitQueueFactory outgoingDataQueuefactory
Factory for creating outgoing data queues.
-
incomingDataQueueFactory
protected RabbitQueueFactory incomingDataQueueFactory
Factory for creating outgoing data queues.
-
rabbitMQHostName
protected String rabbitMQHostName
The host name of the RabbitMQ broker.
-
connectionFactory
protected com.rabbitmq.client.ConnectionFactory connectionFactory
The factory that can be used to create additional connections. However, in most cases it is sufficient to create a new channel using the already existingincomingDataQueueFactoryandoutgoingDataQueuefactoryobjects.
-
-
Method Detail
-
init
public void init() throws ExceptionDescription copied from interface:ComponentThis method initializes the component.
-
createConnection
protected com.rabbitmq.client.Connection createConnection() throws Exception- Throws:
Exception
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getHobbitSessionId
public String getHobbitSessionId()
-
-