public final class ConnectionUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static long |
AMQ_READ_TIMEOUT
The timeout after which the ActiveMQ topic will be freed on read.
|
private static de.hawhamburg.livingplace.messaging.activemq.wrapper.ConnectionSettings |
conSettings
Holds the connection settings.
|
private static long |
WAIT_BEFORE_RECONNECT
Waiting time before reconnect in milliseconds.
|
| Modifier | Constructor and Description |
|---|---|
private |
ConnectionUtil()
Prevent instances of this utility class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getMessageOnTopic(de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber topic)
Checks if there is a message on the topic of the
LPSubscriber object and returns it as String on
success (null instead). |
static de.hawhamburg.livingplace.messaging.activemq.wrapper.LPPublisher |
getPublisher(java.lang.String topic,
StopableObject obj)
Returns an
LPPublisher object related to a certain topic. |
static de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber |
getSubscriber(java.lang.String topic,
StopableObject obj)
Returns an
LPSubscriber object related to a certain topic. |
static void |
setMessageOnTopic(de.hawhamburg.livingplace.messaging.activemq.wrapper.LPPublisher topic,
java.lang.Object jsonMsg)
Tries to send a JSON message object on a certain topic using an
LPPublisher object. |
private static final long WAIT_BEFORE_RECONNECT
private static final long AMQ_READ_TIMEOUT
private static de.hawhamburg.livingplace.messaging.activemq.wrapper.ConnectionSettings conSettings
public static de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber getSubscriber(java.lang.String topic,
StopableObject obj)
LPSubscriber object related to a certain topic. The second parameter should be the calling
object, if it is kind of StopableObject. To ensure, that the connection attempt will be stopped, of the
calling object was shut down.topic - The topics name as String.obj - The calling object, if it's a StopableObject (null instead).LPSubscriber object to read messages from this topic.public static de.hawhamburg.livingplace.messaging.activemq.wrapper.LPPublisher getPublisher(java.lang.String topic,
StopableObject obj)
LPPublisher object related to a certain topic. The second parameter should be the calling
object, if it is kind of StopableObject. To ensure, that the connection attempt will be stopped, of the
calling object was shut down.topic - The topics name as String.obj - The calling object, if it's a StopableObject (null instead).LPPublisher object to set messages on this topic.public static java.lang.String getMessageOnTopic(de.hawhamburg.livingplace.messaging.activemq.wrapper.LPSubscriber topic)
LPSubscriber object and returns it as String on
success (null instead).topic - An LPSubscriber object, which shall be checked for new messages.String on success, otherwise null.public static void setMessageOnTopic(de.hawhamburg.livingplace.messaging.activemq.wrapper.LPPublisher topic,
java.lang.Object jsonMsg)
LPPublisher object.topic - An LPPublisher object to send on.jsonMsg - A JSON message object.