public class MessageDrivenContainer
extends java.lang.Object
IMPORTANT: the transactional behaviour guarantees redelivery after failures. As a side-effect, this can lead to so-called poison messages: messages whose processing repeatedly fails due to some recurring error (for instance, a primary key violation in the database, a NullPointerException, ...). Poison messages are problematic because they can prevent other messages from being processed, and block the system. To avoid poison messages, make sure that your MessageListener implementation only throws a RuntimeException when the problem is transient. In that case, the system will perform rollback and the message will be redelivered facing a clean system state. All non-transient errors (i.e., those that happen each time a message is delivered) indicate problems at the application level and should be dealt with by writing better application code.
| Constructor and Description |
|---|
MessageDrivenContainer() |
| Modifier and Type | Method and Description |
|---|---|
AtomikosConnectionFactoryBean |
getAtomikosConnectionFactoryBean() |
boolean |
getDaemonThreads()
Tests whether threads are daemon threads.
|
javax.jms.Destination |
getDestination()
Gets the destination.
|
java.lang.String |
getDestinationName()
Gets the destination name.
|
javax.jms.ExceptionListener |
getExceptionListener()
Gets the exception listener (if any).
|
javax.jms.MessageListener |
getMessageListener()
Get the message listener if any.
|
java.lang.String |
getMessageSelector()
Get the message selector (if any)
|
protected boolean |
getNoLocal() |
boolean |
getNotifyListenerOnClose()
Getter to check whether the listener is notified on close.
|
int |
getPoolSize()
Get the size of the pool.
|
int |
getReceiveTimeout()
Gets the receive timeout in seconds.
|
java.lang.String |
getSubscriberName()
Gets the subscriber name (for durable subscribers).
|
int |
getTransactionTimeout()
Get the transaction timeout.
|
boolean |
getUnsubscribeOnClose()
Getter to test if unsubscribe should be called on close.
|
java.lang.String |
getUser()
Get the user for connecting, or null if the default user should be used.
|
boolean |
isNoLocal()
Test if this instance will receive sends from the same connection.
|
void |
setAtomikosConnectionFactoryBean(AtomikosConnectionFactoryBean bean)
Sets the connection factory to use.
|
void |
setClientID(java.lang.String clientID)
Sets the clientID for durable subscriptions.
|
void |
setDaemonThreads(boolean value)
Sets whether threads should be daemon threads or not (optional).
|
void |
setDestination(javax.jms.Destination dest)
Sets the JMS destination to listen on (required unless the destinationName is set instead).
|
void |
setDestinationName(java.lang.String destinationName)
Sets the JMS provider-specific destination name
(required unless the destination is set directly).
|
void |
setExceptionListener(javax.jms.ExceptionListener exceptionListener)
Sets the exception listener (optional).
|
void |
setMessageListener(javax.jms.MessageListener listener)
Set the message listener to use (required).
|
void |
setMessageSelector(java.lang.String selector)
Set the message selector to use (optional).
|
void |
setNoLocal(boolean noLocal)
Sets whether or not this topic should receive sends from the
same connection (optional).
|
void |
setNotifyListenerOnClose(boolean b)
Set whether the listener should be notified of close events on the pool
(optional).
|
void |
setPassword(java.lang.String string)
Set the password if explicit authentication is needed (optional).
|
void |
setPoolSize(int size)
Sets the size of the session pool (optional).
|
void |
setReceiveTimeout(int seconds)
Sets the receive timeout in seconds,
i.e.
|
void |
setSubscriberName(java.lang.String subscriberName)
Sets the name to use for durable subscriptions (optional).
|
void |
setTransactionTimeout(int seconds)
Set the transaction timeout in seconds (optional).
|
void |
setUnsubscribeOnClose(boolean b)
Sets whether unsubscribe should be done at closing time (optional).
|
void |
setUser(java.lang.String string)
Set the user to use for explicit authentication (optional).
|
void |
start()
Start listening for messages.
|
void |
stop()
Stop listening for messages.
|
public void setClientID(java.lang.String clientID)
clientID - public void setAtomikosConnectionFactoryBean(AtomikosConnectionFactoryBean bean)
bean - public AtomikosConnectionFactoryBean getAtomikosConnectionFactoryBean()
public javax.jms.Destination getDestination()
public void setDestination(javax.jms.Destination dest)
dest - public java.lang.String getDestinationName()
public void setDestinationName(java.lang.String destinationName)
destinationName - public void setDaemonThreads(boolean value)
value - If true then threads will be daemon threads.public boolean getDaemonThreads()
public javax.jms.MessageListener getMessageListener()
public int getTransactionTimeout()
public java.lang.String getUser()
public void setMessageListener(javax.jms.MessageListener listener)
listener - public void setPassword(java.lang.String string)
string - public void setTransactionTimeout(int seconds)
seconds - public void setUser(java.lang.String string)
string - public java.lang.String getMessageSelector()
public void setMessageSelector(java.lang.String selector)
selector - public int getPoolSize()
public void setPoolSize(int size)
size - public javax.jms.ExceptionListener getExceptionListener()
public void setExceptionListener(javax.jms.ExceptionListener exceptionListener)
exceptionListener - public boolean isNoLocal()
public void setNoLocal(boolean noLocal)
noLocal - public java.lang.String getSubscriberName()
public void setSubscriberName(java.lang.String subscriberName)
subscriberName - protected boolean getNoLocal()
public void start()
throws javax.jms.JMSException
javax.jms.JMSExceptionpublic void stop()
public boolean getNotifyListenerOnClose()
public void setNotifyListenerOnClose(boolean b)
b - If true, then the listener will receive a null message if the
pool is closed.public void setUnsubscribeOnClose(boolean b)
b - If true, then unsubscribe will be done at closing time. This only applies to
durable subscribers (i.e., cases where subscriberName is set).public boolean getUnsubscribeOnClose()
public int getReceiveTimeout()
public void setReceiveTimeout(int seconds)
seconds - Copyright © 2018. All Rights Reserved.