public class PublicationListener
extends java.lang.Thread
start
. To stop the listener, use
stopListener
. The listener stops after a wait time of 10
seconds. If the listener receives the last message of a publication, it
commits this publication and starts receiving messages with a new
publication.Constructor and Description |
---|
PublicationListener(Broker broker,
java.lang.String topicName,
java.lang.String wait,
MessageListener listener)
Creates a
PublicationListener with a
MessageListener . |
Modifier and Type | Method and Description |
---|---|
BrokerException |
getLastException()
Gets the last BrokerException which occurred in the
run
method of this listener. |
void |
run()
Receives messages in publications.
|
void |
stopListener()
Stop the listener.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public PublicationListener(Broker broker, java.lang.String topicName, java.lang.String wait, MessageListener listener)
PublicationListener
with a
MessageListener
.broker
- the Broker
object.topicName
- the name of the topic.wait
- the wait time for the receive calls.listener
- the object implementing the onMessage
method.public void run()
stopListener
or if a BrokerException
occurs.run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void stopListener()
public BrokerException getLastException()
run
method of this listener.BrokerException
.