T
- the Message
object type to convert to before handlingpublic class JMSListenerContainer<T>
extends java.lang.Object
MessageListener
s created by the
JMSListener
and
AbstractJMSListenerMethodProcessor
processing. There is support for programmatically instantiating listeners
however this has not been fully incorporated into a coherent API yet and has
not been fully tested. It is recommended to instead use the
JMSListener
annotation on existing classes.Constructor and Description |
---|
JMSListenerContainer(JMSConnectionPool connectionPool,
JMSDestinationType type,
int threadPoolSize) |
JMSListenerContainer(JMSConnectionPool connectionPool,
JMSDestinationType type,
int threadPoolSize,
int maxThreadPoolSize) |
Modifier and Type | Method and Description |
---|---|
void |
registerListener(java.lang.String destination,
MessageHandler<T> listener,
java.lang.Class<T> clazz)
Registers a
JMSListenerContainer with default concurrency. |
void |
registerListener(java.lang.String destination,
javax.jms.MessageListener listener,
java.lang.Class<T> clazz,
boolean transacted,
int acknowledgeMode)
Internal method used by the
JMSListenerContainerFactory for
registering new listeners. |
boolean |
shutdown()
Safely shuts down all open connections linked to the listener container.
|
java.lang.String |
toString() |
public JMSListenerContainer(JMSConnectionPool connectionPool, JMSDestinationType type, int threadPoolSize)
connectionPool
- the JMSConnectionPool
to pull
Connection
s from to create MessageListener
stype
- either JMSDestinationType.QUEUE
or JMSDestinationType.TOPIC
.threadPoolSize
- the pool sizepublic JMSListenerContainer(JMSConnectionPool connectionPool, JMSDestinationType type, int threadPoolSize, int maxThreadPoolSize)
connectionPool
- the JMSConnectionPool
to pull
Connection
s from to create MessageListener
stype
- either JMSDestinationType.QUEUE
or JMSDestinationType.TOPIC
.threadPoolSize
- the minimum core thread pool sizemaxThreadPoolSize
- the maximum number of threads to use handling incoming requestspublic void registerListener(java.lang.String destination, MessageHandler<T> listener, java.lang.Class<T> clazz)
JMSListenerContainer
with default concurrency.
NOTE: this method is not recommended; instead use the annotation driven
JMSListener
destination
- the queue or topic namelistener
- the message handlerclazz
- the message typepublic void registerListener(java.lang.String destination, javax.jms.MessageListener listener, java.lang.Class<T> clazz, boolean transacted, int acknowledgeMode)
JMSListenerContainerFactory
for
registering new listeners.
NOTE: this method is used internally by the
AbstractJMSListenerMethodProcessor
and is not recommended for use. Instead the annotation driven
JMSListener
is preferred.
destination
- the queue or topic namelistener
- the message handlerclazz
- the message typetransacted
- indicates whether the session will use a local transactionacknowledgeMode
- when transacted is false, indicates how messages
received by the session will be acknowledgedSession.AUTO_ACKNOWLEDGE
,
Session.CLIENT_ACKNOWLEDGE
,
Session.DUPS_OK_ACKNOWLEDGE
@PreDestroy public boolean shutdown()
public java.lang.String toString()
toString
in class java.lang.Object