public abstract class BaseJmsPollingConsumerImpl extends AdaptrisPollingConsumer implements JmsActorConfig
AdaptrisPollingConsumer.LockOperator
log
Constructor and Description |
---|
BaseJmsPollingConsumerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
protected void |
closeMessageConsumer() |
protected void |
closeSession() |
int |
configuredAcknowledgeMode()
Return the current acknowledge mode.
|
CorrelationIdSource |
configuredCorrelationIdSource()
Return the current correlation id source.
|
AdaptrisMessageListener |
configuredMessageListener()
return the current configured MessageListener.
|
MessageTypeTranslator |
configuredMessageTranslator()
Return the currently configured messageTranslator.
|
java.lang.String |
consumeLocationKey()
Provides the metadata key "JMSDestination" which will only be populated if
MessageTypeTranslatorImp.getMoveJmsHeaders() is true. |
protected abstract javax.jms.MessageConsumer |
createConsumer() |
protected abstract javax.jms.Session |
createSession(int acknowledgeMode,
boolean transacted) |
javax.jms.Session |
currentSession()
Return the current jms session.
|
protected int |
doProcessMessage() |
java.lang.String |
getAcknowledgeMode()
Sets the JMS acknowledge mode to use.
|
CorrelationIdSource |
getCorrelationIdSource()
Sets correlationIdSource.
|
java.lang.String |
getMessageSelector()
The filter expression to use when matching messages to consume
|
@NonNull MessageTypeTranslator |
getMessageTranslator()
Sets the MessageTypeTranslator to use.
|
TimeInterval |
getReceiveTimeout()
Sets the period that this class should wait for the broker to deliver a message.
|
void |
init()
Initialises the component.
|
protected void |
initConsumer() |
protected void |
initSession() |
boolean |
isManagedTransaction() |
javax.jms.MessageConsumer |
messageConsumer() |
OnMessageHandler |
messageHandler() |
long |
rollbackTimeout()
How long we should wait after a rollback before continuing on with
processing
|
void |
setAcknowledgeMode(java.lang.String acknowledgeMode)
Sets the JMS acknowledge mode to use.
|
void |
setCorrelationIdSource(CorrelationIdSource correlationIdSource)
Sets correlationIdSource.
|
void |
setManagedTransaction(boolean managedTransaction) |
void |
setMessageSelector(java.lang.String messageSelector)
The filter expression to use when matching messages to consume
|
void |
setMessageTranslator(@NonNull MessageTypeTranslator messageTranslator)
Sets the MessageTypeTranslator to use.
|
void |
setReceiveTimeout(TimeInterval receiveTimeout)
Sets the period that this class should wait for the broker to deliver a message.
|
continueProcessingMessages, getMaxMessagesPerPoll, getPoller, getReacquireLockBetweenMessages, prepare, prepareConsumer, processMessages, releaseLock, setMaxMessagesPerPoll, setPoller, setReacquireLockBetweenMessages, start, stop
changeState, newThreadName, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
currentLogger
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isTrackingEndpoint
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
init
in class AdaptrisPollingConsumer
CoreException
- wrapping any underlying Exception
sComponentLifecycle.init()
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely. Throwing a RuntimeException
may
cause unintended consequences
close
in interface ComponentLifecycle
close
in class AdaptrisPollingConsumer
ComponentLifecycle.close()
protected void initConsumer() throws javax.jms.JMSException, CoreException
javax.jms.JMSException
CoreException
protected abstract javax.jms.MessageConsumer createConsumer() throws javax.jms.JMSException, CoreException
javax.jms.JMSException
CoreException
public javax.jms.MessageConsumer messageConsumer()
protected void closeMessageConsumer()
public OnMessageHandler messageHandler()
protected int doProcessMessage()
public long rollbackTimeout()
JmsActorConfig
rollbackTimeout
in interface JmsActorConfig
public CorrelationIdSource configuredCorrelationIdSource()
JmsActorConfig
configuredCorrelationIdSource
in interface JmsActorConfig
public MessageTypeTranslator configuredMessageTranslator()
JmsActorConfig
configuredMessageTranslator
in interface JmsActorConfig
public int configuredAcknowledgeMode()
JmsActorConfig
configuredAcknowledgeMode
in interface JmsActorConfig
protected void initSession() throws javax.jms.JMSException, CoreException
javax.jms.JMSException
CoreException
protected abstract javax.jms.Session createSession(int acknowledgeMode, boolean transacted) throws javax.jms.JMSException
javax.jms.JMSException
public javax.jms.Session currentSession()
JmsActorConfig
currentSession
in interface JmsActorConfig
protected void closeSession()
public void setManagedTransaction(boolean managedTransaction)
public boolean isManagedTransaction()
isManagedTransaction
in interface JmsActorConfig
public AdaptrisMessageListener configuredMessageListener()
JmsActorConfig
configuredMessageListener
in interface JmsActorConfig
public java.lang.String consumeLocationKey()
MessageTypeTranslatorImp.getMoveJmsHeaders()
is true.consumeLocationKey
in interface AdaptrisMessageConsumer
public java.lang.String getAcknowledgeMode()
The value may be AUTO_KNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE or the int values
corresponding to the JMS Session Constant. If not set explicitly then defaults to
CLIENT_ACKNOWLEDGE
.
public void setAcknowledgeMode(java.lang.String acknowledgeMode)
The value may be AUTO_KNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE or the int values
corresponding to the JMS Session Constant. If not set explicitly then defaults to
CLIENT_ACKNOWLEDGE
.
@NonNull public @NonNull MessageTypeTranslator getMessageTranslator()
If not configured explicitly then defaults to AutoConvertMessageTranslator
which
attempts to do the right thing
public void setMessageTranslator(@NonNull @NonNull MessageTypeTranslator messageTranslator)
If not configured explicitly then defaults to AutoConvertMessageTranslator
which
attempts to do the right thing
public CorrelationIdSource getCorrelationIdSource()
If not configured explicitly then defaults to NullCorrelationIdSource
.
public void setCorrelationIdSource(CorrelationIdSource correlationIdSource)
If not configured explicitly then defaults to NullCorrelationIdSource
.
public TimeInterval getReceiveTimeout()
The default value of 2 seconds should be suitable in most situations. If there is a high degree of network latency and this class does not consume messages from Queues / Topics as expected try setting a higher value.
public void setReceiveTimeout(TimeInterval receiveTimeout)
The default value of 2 seconds should be suitable in most situations. If there is a high degree of network latency and this class does not consume messages from Queues / Topics as expected try setting a higher value.
public java.lang.String getMessageSelector()
public void setMessageSelector(java.lang.String messageSelector)