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
Constructor and Description |
---|
JmsConsumerImpl()
Creates a new instance.
|
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.
|
protected abstract java.lang.String |
configuredEndpoint() |
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() |
org.slf4j.Logger |
currentLogger()
Return the configured logger.
|
javax.jms.Session |
currentSession()
Return the current jms session.
|
protected java.lang.String |
endpoint() |
java.lang.String |
getAcknowledgeMode()
Returns the JMS acknowledge mode to use.
|
CorrelationIdSource |
getCorrelationIdSource()
Returns correlationIdSource.
|
ConsumeDestination |
getDestination()
Deprecated.
since 3.11.0 use the
endpoint/queue/topic configuration available on the
concrete consumer |
java.lang.String |
getMessageSelector()
The message selector to use when matching messages to consume
|
MessageTypeTranslator |
getMessageTranslator()
Returns the MessageTypeTranslator to use.
|
void |
init()
Initialises the component.
|
boolean |
isManagedTransaction() |
protected java.lang.String |
messageSelector() |
protected java.lang.String |
newThreadName() |
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 |
setDestination(ConsumeDestination destination)
Deprecated.
since 3.11.0 use the
endpoint/queue/topic configuration available on the
concrete consumer |
void |
setManagedTransaction(boolean managedTransaction) |
void |
setMessageSelector(java.lang.String messageSelector)
The message selector to use when matching messages to consume
|
void |
setMessageTranslator(MessageTypeTranslator translator)
Sets the MessageTypeTranslator to use.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
changeState, 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
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isTrackingEndpoint
public JmsConsumerImpl()
Creates a new instance. Default session type is client acknowledge, default JMS message type is text.
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
protected java.lang.String messageSelector()
protected java.lang.String endpoint()
protected java.lang.String newThreadName()
newThreadName
in class AdaptrisMessageConsumerImp
protected abstract java.lang.String configuredEndpoint()
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
public java.lang.String consumeLocationKey()
MessageTypeTranslatorImp.getMoveJmsHeaders()
is true.consumeLocationKey
in interface AdaptrisMessageConsumer
@Deprecated @Removal(version="4.0.0", message="since 3.11.0 use the endpoint/queue/topic configuration available on the concrete consumer") public ConsumeDestination getDestination()
endpoint/queue/topic
configuration available on the
concrete consumerDepending on the flavour of the concrete consumer it may be a RFC6167 style string, a queue or a topic
@Deprecated public void setDestination(@Removal(version="4.0.0",message="since 3.11.0 use the endpoint/queue/topic configuration available on the concrete consumer") ConsumeDestination destination)
endpoint/queue/topic
configuration available on the
concrete consumerDepending on the flavour of the concrete consumer it may be a RFC6167 style string, a queue or a topic
public java.lang.String getMessageSelector()
public void setMessageSelector(java.lang.String messageSelector)