public class AndesJMSConsumer extends AndesJMSBase implements Runnable, javax.jms.MessageListener
jmsConfig| Constructor and Description |
|---|
AndesJMSConsumer(AndesJMSConsumerClientConfiguration config,
boolean createConsumer)
Creates a new JMS consumer with a given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getAverageLatency()
Gets the average latency for the consumer in receiving messages.
|
AndesJMSConsumerClientConfiguration |
getConfig()
Gets the configuration.
|
javax.jms.Connection |
getConnection()
Gets the JMS message consuming connection (
Connection). |
double |
getConsumerTPS()
Gets the consumer transactions per seconds.
|
AtomicLong |
getReceivedMessageCount()
Gets the received message count for the consumer.
|
javax.jms.MessageConsumer |
getReceiver()
Gets the JMS message consumer (
MessageConsumer). |
javax.jms.Session |
getSession()
Gets the JMS message consuming session (
Session). |
void |
onMessage(javax.jms.Message message) |
void |
run() |
void |
setConnection(javax.jms.Connection connection)
Sets the JMS message consuming connection (
Connection). |
void |
setReceiver(javax.jms.MessageConsumer receiver)
Sets the JMS message consumer (
MessageConsumer). |
void |
setSession(javax.jms.Session session)
Sets the JMS message consuming session (
Session). |
void |
startClient()
Starts up the publisher or consumer.
|
void |
stopClient()
Stops the publisher or consumer
|
void |
stopClientSync() |
void |
unSubscribe(boolean stopClient)
Un-Subscribes and closes a consumers.
|
getInitialContextpublic AndesJMSConsumer(AndesJMSConsumerClientConfiguration config, boolean createConsumer) throws NamingException, javax.jms.JMSException
config - The configuration.createConsumer - Creates the connection, session and receiver.NamingExceptionjavax.jms.JMSExceptionpublic void startClient()
throws AndesClientException,
javax.jms.JMSException
startClient in class AndesJMSBasejavax.jms.JMSExceptionAndesClientExceptionpublic void stopClient()
stopClient in class AndesJMSBasepublic void stopClientSync()
public void unSubscribe(boolean stopClient)
throws javax.jms.JMSException
stopClient - true if the client needs to stopped after un-subscribing, false otherwise.javax.jms.JMSExceptionpublic void onMessage(javax.jms.Message message)
onMessage in interface javax.jms.MessageListenerpublic AtomicLong getReceivedMessageCount()
public double getConsumerTPS()
public double getAverageLatency()
public AndesJMSConsumerClientConfiguration getConfig()
getConfig in class AndesJMSBasepublic javax.jms.Connection getConnection()
Connection).Connectionpublic void setConnection(javax.jms.Connection connection)
Connection).connection - A Connection.public javax.jms.Session getSession()
Session).Session.public void setSession(javax.jms.Session session)
Session).session - A Session.public javax.jms.MessageConsumer getReceiver()
MessageConsumer).MessageConsumer.public void setReceiver(javax.jms.MessageConsumer receiver)
MessageConsumer).receiver - A MessageConsumer.Copyright © 2019 WSO2. All rights reserved.