public abstract class JmsConsumerImpl extends AdaptrisMessageConsumerImp implements javax.jms.MessageListener, JmsActorConfig
Contains behaviour common to PTP and PAS JMS message consumers.
Modifier and Type | Field and Description |
---|---|
protected javax.jms.MessageConsumer |
consumer |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
JmsConsumerImpl()
Creates a new instance.
|
JmsConsumerImpl(ConsumeDestination d) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
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.
|
protected abstract javax.jms.MessageConsumer |
createConsumer() |
org.slf4j.Logger |
currentLogger()
Return the configured logger.
|
javax.jms.Session |
currentSession()
Return the current jms session.
|
java.lang.String |
getAcknowledgeMode()
Returns the JMS acknowledge mode to use.
|
CorrelationIdSource |
getCorrelationIdSource()
Returns correlationIdSource.
|
MessageTypeTranslator |
getMessageTranslator()
Returns the MessageTypeTranslator to use.
|
void |
init()
Initialises the component.
|
boolean |
isManagedTransaction() |
void |
onMessage(javax.jms.Message msg)
Called by the JMS
Session to deliver messages. |
void |
prepare()
Prepare for initialisation.
|
long |
rollbackTimeout()
How long we should wait after a rollback before continuing on with
processing
|
void |
setAcknowledgeMode(java.lang.String i)
Sets the JMS acknowledge mode to use.
|
void |
setCorrelationIdSource(CorrelationIdSource c)
Sets correlationIdSource.
|
void |
setManagedTransaction(boolean managedTransaction) |
void |
setMessageTranslator(MessageTypeTranslator translator)
Sets the MessageTypeTranslator to use.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
changeState, getDestination, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState, setDestination
createName, createQualifier, decode, encode, getEncoder, getIsConfirmation, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isConfirmation, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsConfirmation, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isConfirmation, isTrackingEndpoint
public JmsConsumerImpl()
Creates a new instance. Default session type is client acknowledge, default JMS message type is text.
public JmsConsumerImpl(ConsumeDestination d)
public void onMessage(javax.jms.Message msg)
Called by the JMS Session
to deliver messages.
onMessage
in interface javax.jms.MessageListener
msg
- a javax.jms.Message
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
sComponentLifecycle.init()
protected abstract javax.jms.MessageConsumer createConsumer() throws javax.jms.JMSException, CoreException
javax.jms.JMSException
CoreException
public void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing a
RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.
start
in interface ComponentLifecycle
CoreException
- wrapping any underlying Exception
spublic 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
public long rollbackTimeout()
JmsActorConfig
rollbackTimeout
in interface JmsActorConfig
public void setMessageTranslator(MessageTypeTranslator translator)
Sets the MessageTypeTranslator to use.
translator
- the MessageTypeTranslator to usepublic MessageTypeTranslator getMessageTranslator()
Returns the MessageTypeTranslator to use.
public void setAcknowledgeMode(java.lang.String i)
Sets the JMS acknowledge mode to use.
The value may be AUTO_KNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE or the int values corresponding to the JMS Session Constant
i
- the JMS acknowledge mode to usepublic java.lang.String getAcknowledgeMode()
Returns the JMS acknowledge mode to use.
public CorrelationIdSource getCorrelationIdSource()
Returns correlationIdSource.
public void setCorrelationIdSource(CorrelationIdSource c)
Sets correlationIdSource.
c
- the correlationIdSource to setpublic CorrelationIdSource configuredCorrelationIdSource()
JmsActorConfig
configuredCorrelationIdSource
in interface JmsActorConfig
public MessageTypeTranslator configuredMessageTranslator()
JmsActorConfig
configuredMessageTranslator
in interface JmsActorConfig
public int configuredAcknowledgeMode()
JmsActorConfig
configuredAcknowledgeMode
in interface JmsActorConfig
public AdaptrisMessageListener configuredMessageListener()
JmsActorConfig
configuredMessageListener
in interface JmsActorConfig
public javax.jms.Session currentSession()
JmsActorConfig
currentSession
in interface JmsActorConfig
public org.slf4j.Logger currentLogger()
JmsActorConfig
currentLogger
in interface JmsActorConfig
public void setManagedTransaction(boolean managedTransaction)
public boolean isManagedTransaction()
isManagedTransaction
in interface JmsActorConfig