public class SimpleMessagePoller extends Object implements MessagePoller, Runnable
MessagePoller
implementing a simple polling strategy that waits at most 30 seconds using
MessageConsumer.receive(long)
and then loop over. When a message is received, the MessageListener
is
invoked and the session is committed. If an exception occurs the session is rollbacked, the ExceptionListener
is invoked if any, the polling thread is shutdown and scheduled for restart in 10 seconds.Constructor and Description |
---|
SimpleMessagePoller() |
Modifier and Type | Method and Description |
---|---|
void |
run() |
void |
setExceptionListener(javax.jms.ExceptionListener exceptionListener) |
void |
setMessageConsumer(javax.jms.MessageConsumer messageConsumer) |
void |
setMessageListener(javax.jms.MessageListener messageListener) |
void |
setSession(javax.jms.Session session) |
void |
start() |
void |
stop() |
public void setSession(javax.jms.Session session)
setSession
in interface MessagePoller
public void setMessageConsumer(javax.jms.MessageConsumer messageConsumer)
setMessageConsumer
in interface MessagePoller
public void setExceptionListener(javax.jms.ExceptionListener exceptionListener)
setExceptionListener
in interface MessagePoller
public void setMessageListener(javax.jms.MessageListener messageListener)
setMessageListener
in interface MessagePoller
public void start()
start
in interface MessagePoller
public void stop()
stop
in interface MessagePoller
Copyright © 2013-2018–2019 SeedStack. All rights reserved.