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
This abstract class implements basic functionalities of a hobbit component.
- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HobbitConfigurationConfiguration that is used by this component.protected com.rabbitmq.client.ConnectionFactoryThe factory that can be used to create additional connections.private Stringprotected RabbitQueueFactoryFactory for creating outgoing data queues.private static final org.slf4j.Loggerstatic final intMaximum number of retries that are executed to connect to RabbitMQ.protected RabbitQueueFactoryFactory for creating outgoing data queues.protected StringThe host name of the RabbitMQ broker.static final longTime, the system waits before retrying to connect to RabbitMQ. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected com.rabbitmq.client.ConnectiongenerateSessionQueueName(String queueName) voidinit()This method initializes the component.voidsetConfiguration(HobbitConfiguration configuration) Setter for the configuration that the component should make use of.
-
Field Details
-
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_MQMaximum number of retries that are executed to connect to RabbitMQ.- See Also:
-
START_WAITING_TIME_BEFORE_RETRY
public static final long START_WAITING_TIME_BEFORE_RETRYTime, 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:
-
hobbitSessionId
-
outgoingDataQueuefactory
Factory for creating outgoing data queues. -
incomingDataQueueFactory
Factory for creating outgoing data queues. -
rabbitMQHostName
The host name of the RabbitMQ broker. -
connectionFactory
protected com.rabbitmq.client.ConnectionFactory connectionFactoryThe 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. -
configuration
Configuration that is used by this component.
-
-
Constructor Details
-
AbstractComponent
public AbstractComponent()Default constructor. It will create a configuration object that is solely relying on environment variables. This is the same as using the following lines of code:HobbitConfiguration configuration = new HobbitConfiguration(); configuration.addConfiguration(new EnvironmentConfiguration()); AbstractComponent component = new AbstractComponent(); component.setConfiguration(configuration);
-
-
Method Details
-
init
Description copied from interface:ComponentThis method initializes the component. -
createConnection
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getHobbitSessionId
-
generateSessionQueueName
-
getConfiguration
- Returns:
- the configuration
-
setConfiguration
Description copied from interface:ComponentSetter for the configuration that the component should make use of.- Specified by:
setConfigurationin interfaceComponent- Parameters:
configuration- the configuration that is used by this component
-