public class BrokerConnection extends Object
| Constructor and Description |
|---|
BrokerConnection(String name,
javax.jms.ConnectionFactory connectionFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection to the broker.
|
void |
connect()
Connects to the destination broker and creates the emitter session on the broker connection.
|
void |
emitTopicMessage(String topic,
String message)
Emits the given message to the specified topic
|
String |
getName()
Returns the connection name.
|
boolean |
isConnected()
Determines whether the connection is opened.
|
void |
registerQueueListener(String queue,
MessagingBrokerQueueListener listener,
TopicAccessor topicAccessor,
int maxFailedCount)
Registers the queue listener for the specified queue.
|
public BrokerConnection(String name, javax.jms.ConnectionFactory connectionFactory)
name - name of the connectionconnectionFactory - JMS connection factorypublic void connect()
throws IOException
IOException - when any errors occurspublic void close()
throws javax.jms.JMSException
javax.jms.JMSException - if the JMS provider fails to close the connection due to some internal error.public void registerQueueListener(String queue, MessagingBrokerQueueListener listener, TopicAccessor topicAccessor, int maxFailedCount) throws IOException
queue - the queue namelistener - the queue listenerstopicAccessor - the topic accessor in order to extract the destination topic from the
delivered message.maxFailedCount - the amount of attempts to treat the message before the message is going
to be acknowledged. If the value is null the amount of attempts is unlimited.IOException - when any errors occurspublic void emitTopicMessage(String topic, String message)
topic - topicmessage - raw messagepublic String getName()
public boolean isConnected()
true if opened and false otherwise.Copyright © 2021. All rights reserved.