Class PullingJmsListener
- All Implemented Interfaces:
HasPhysicalDestination
,HasSender
,IConfigurable
,IConfigurationAware
,ICorrelatedPullingListener<jakarta.jms.Message>
,IListener<jakarta.jms.Message>
,INamedObject
,IPostboxListener<jakarta.jms.Message>
,IPullingListener<jakarta.jms.Message>
,IRedeliveringListener<jakarta.jms.Message>
,IScopeProvider
,IWithParameters
,IXAEnabled
,RunStateEnquiring
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Listener
-class.
Since version 4.1, Ibis supports distributed transactions using the XA-protocol. This feature is controlled by the
transacted
attribute. If this is set to true
, received messages are
committed or rolled back, possibly together with other actions, by the receiver or the pipeline.
In case of a failure, all actions within the transaction are rolled back.
Using jmsTransacted and acknowledgement
If jmsTransacted is set true
: it should ensure that a message is received and processed on a both or nothing basis.
IBIS will commit the the message, otherwise perform rollback. However using jmsTransacted, IBIS does not bring transactions within
the adapters under transaction control, compromising the idea of atomic transactions. In the roll-back situation messages sent to
other destinations within the Pipeline are NOT rolled back if jmsTransacted is set true
! In the failure situation the
message is therefore completely processed, and the roll back does not mean that the processing is rolled back! To obtain the correct
(transactional) behaviour, transacted
should be used instead of listener.transacted
.
Setting listener.acknowledgeMode
to "auto" means that messages are allways acknowledged (removed from
the queue, regardless of what the status of the Adapter is. "client" means that the message will only be removed from the queue
when the state of the Adapter equals the success state.
The "dups" mode instructs the session to lazily acknowledge the delivery of the messages. This is likely to result in the
delivery of duplicate messages if JMS fails. It should be used by consumers who are tolerant in processing duplicate messages.
In cases where the client is tolerant of duplicate messages, some enhancement in performance can be achieved using this mode,
since a session has lower overhead in trying to prevent duplicate messages.
The setting for listener.acknowledgeMode
will only be processed if
the setting for listener.transacted
as well as for
listener.jmsTransacted
is false.
If useReplyTo
is set and a replyTo-destination is
specified in the message, the JmsListener sends the result of the processing
in the pipeline to this destination. Otherwise the result is sent using the (optionally)
specified Sender
, that in turn sends the message to
whatever it is configured to.
Notice: the JmsListener is ONLY capable of processing
jakarta.jms.TextMessage
s
- Since:
- 4.0.1
- Author:
- Gerrit van Brakel
-
Nested Class Summary
Nested classes/interfaces inherited from class org.frankframework.jms.JMSFacade
JMSFacade.AcknowledgeMode, JMSFacade.DeliveryMode, JMSFacade.DestinationType, JMSFacade.MessageClass, JMSFacade.SubscriberType
-
Field Summary
Fields inherited from class org.frankframework.jms.JMSFacade
JMS_MESSAGECLASS_KEY, messagingSource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterMessageProcessed
(PipeLineResult plr, RawMessageWrapper<jakarta.jms.Message> rawMessageWrapper, PipeLineSession pipeLineSession) Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.protected boolean
canGoOn()
void
closeThread
(Map<String, Object> threadContext) Finalizes a message receiving thread.RawMessageWrapper<jakarta.jms.Message>
getRawMessage
(String correlationId, Map<String, Object> threadContext) Retrieves messages from queue or other channel, but retrieves only messages with the specified correlationId.RawMessageWrapper<jakarta.jms.Message>
getRawMessage
(Map<String, Object> threadContext) Retrieves messages from queue or other channel, but does no processing on it.protected jakarta.jms.MessageConsumer
getReceiver
(Map<String, Object> threadContext, jakarta.jms.Session session, String correlationId) protected jakarta.jms.Session
getSession
(Map<String, Object> threadContext) Prepares a thread for receiving messages.protected void
releaseReceiver
(jakarta.jms.MessageConsumer receiver, String correlationId) protected void
releaseSession
(jakarta.jms.Session session) RawMessageWrapper<jakarta.jms.Message>
retrieveRawMessage
(String messageSelector, Map<String, Object> threadContext) Retrieves the first message found from queue or other channel, that matches the specifiedmessageSelector
.protected void
sendReply
(PipeLineResult plr, jakarta.jms.Destination replyTo, String replyCid, long timeToLive, boolean ignoreInvalidDestinationException, PipeLineSession pipeLineSession, Map<String, Object> properties) void
SetRunStateEnquirer
(RunStateEnquirer enquirer) Methods inherited from class org.frankframework.jms.AbstractJmsListener
addParameter, configure, extractMessage, extractMessageProperties, getForceMessageIdAsCorrelationId, getMessageProperties, getParameterList, getReplyDeliveryMode, getReplyDestinationName, getReplyEncodingStyleURI, getReplyMessageTimeToLive, getReplyMessageType, getReplyNamespaceURI, getReplyPriority, getReplySoapAction, getSender, getSoapHeaderSessionKey, getTimeout, isSoap, isUseReplyTo, messageWillBeRedeliveredOnExitStateError, prepareReply, prepareReply, setForceMessageIdAsCorrelationId, setReplyDeliveryMode, setReplyDestinationName, setReplyEncodingStyleURI, setReplyMessageTimeToLive, setReplyMessageType, setReplyNamespaceURI, setReplyPriority, setReplySoapAction, setSender, setSoap, setSoapHeaderSessionKey, setTimeout, setUseReplyTo, start, stop
Methods inherited from class org.frankframework.jms.JMSFacade
checkTransactionManagerValidity, closeSession, createBytesMessage, createMessage, createMessage, createSession, createTextMessage, extractMessage, extractMessageBody, getAcknowledgeMode, getAuthAlias, getConnectionFactoryFactory, getConnectionFactoryInfo, getConnectionFactoryName, getContext, getCorrelationIdMaxLength, getCorrelationIdToHexPrefix, getDestination, getDestination, getDestinationName, getDestinationType, getDomain, getJmsMessagingSource, getLogPrefix, getMessageClass, getMessageConsumer, getMessageConsumer, getMessageConsumerForCorrelationId, getMessageProducer, getMessageSelector, getMessageTimeToLive, getMessagingSource, getMessagingSourceFactory, getPhysicalDestinationName, getPhysicalDestinationShortName, getPhysicalDestinationShortName, getProxiedDestinationNames, getQueueConnectionFactoryName, getSubscriberType, getTopicConnectionFactoryName, getTxManager, isCorrelationIdToHex, isJmsTransacted, isLookupDestination, isPersistent, isSessionsArePooled, isTransacted, isUseTopicFunctions, logMessageDetails, send, send, send, send, send, send, send, sendByQueue, sendByTopic, setAcknowledgeMode, setAuthAlias, setConnectionFactoryFactory, setCorrelationIdMaxLength, setCorrelationIdToHex, setCorrelationIdToHexPrefix, setDestinationName, setDestinationType, setJmsTransacted, setLookupDestination, setMessageClass, setMessageCorrelationID, setMessageSelector, setMessageTimeToLive, setPersistent, setProxiedDestinationNames, setQueueConnectionFactoryName, setSubscriberType, setTopicConnectionFactoryName, setTransacted, setTxManager, toString
Methods inherited from class org.frankframework.jndi.JndiBase
getApplicationContext, getAuthentication, getConfigurationClassLoader, getContext, getCredentials, getInitialContextFactoryName, getJmsRealmName, getJndiAuthAlias, getJndiContextPrefix, getJndiEnv, getJndiProperties, getName, getPrincipal, getProviderURL, getSecurityProtocol, getUrlPkgPrefixes, setApplicationContext, setAuthentication, setCredentials, setInitialContextFactoryName, setJmsRealm, setJndiAuthAlias, setJndiContextPrefix, setJndiProperties, setName, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.IConfigurationAware
getApplicationContext, getName
Methods inherited from interface org.frankframework.core.IListener
configure, extractMessage, start, stop
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
-
Constructor Details
-
PullingJmsListener
public PullingJmsListener()
-
-
Method Details
-
getSession
- Throws:
ListenerException
-
releaseSession
protected void releaseSession(jakarta.jms.Session session) -
getReceiver
protected jakarta.jms.MessageConsumer getReceiver(Map<String, Object> threadContext, jakarta.jms.Session session, String correlationId) throws ListenerException- Throws:
ListenerException
-
releaseReceiver
protected void releaseReceiver(jakarta.jms.MessageConsumer receiver, String correlationId) throws ListenerException - Throws:
ListenerException
-
openThread
Description copied from interface:IPullingListener
Prepares a thread for receiving messages. Called once for each thread that will listen for messages.- Specified by:
openThread
in interfaceIPullingListener<jakarta.jms.Message>
- Returns:
- the threadContext for this thread. The threadContext is a Map in which
thread-specific data can be stored. May not be
null
, must be a mutable map type. - Throws:
ListenerException
-
closeThread
Description copied from interface:IPullingListener
Finalizes a message receiving thread. Called once for each thread that listens for messages, just beforeIListener.stop()
is called.- Specified by:
closeThread
in interfaceIPullingListener<jakarta.jms.Message>
- Throws:
ListenerException
-
afterMessageProcessed
public void afterMessageProcessed(PipeLineResult plr, RawMessageWrapper<jakarta.jms.Message> rawMessageWrapper, PipeLineSession pipeLineSession) throws ListenerException Description copied from interface:IListener
Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.- Specified by:
afterMessageProcessed
in interfaceIListener<jakarta.jms.Message>
- Overrides:
afterMessageProcessed
in classAbstractJmsListener
- Throws:
ListenerException
-
sendReply
protected void sendReply(PipeLineResult plr, jakarta.jms.Destination replyTo, String replyCid, long timeToLive, boolean ignoreInvalidDestinationException, PipeLineSession pipeLineSession, Map<String, Object> properties) throws SenderException, ListenerException, jakarta.jms.JMSException, IOException- Overrides:
sendReply
in classAbstractJmsListener
- Throws:
SenderException
ListenerException
jakarta.jms.JMSException
IOException
-
getRawMessage
public RawMessageWrapper<jakarta.jms.Message> getRawMessage(@Nonnull Map<String, Object> threadContext) throws ListenerExceptionRetrieves messages from queue or other channel, but does no processing on it.- Specified by:
getRawMessage
in interfaceIPullingListener<jakarta.jms.Message>
- Throws:
ListenerException
-
getRawMessage
public RawMessageWrapper<jakarta.jms.Message> getRawMessage(String correlationId, Map<String, Object> threadContext) throws ListenerException, TimeoutExceptionDescription copied from interface:ICorrelatedPullingListener
Retrieves messages from queue or other channel, but retrieves only messages with the specified correlationId.- Specified by:
getRawMessage
in interfaceICorrelatedPullingListener<jakarta.jms.Message>
- Throws:
ListenerException
TimeoutException
-
retrieveRawMessage
public RawMessageWrapper<jakarta.jms.Message> retrieveRawMessage(String messageSelector, Map<String, Object> threadContext) throws ListenerExceptionDescription copied from interface:IPostboxListener
Retrieves the first message found from queue or other channel, that matches the specifiedmessageSelector
.- Specified by:
retrieveRawMessage
in interfaceIPostboxListener<jakarta.jms.Message>
- Parameters:
messageSelector
- search criteria for messages. Not that the format of the selector changes per listener, for example a JMSListener's messageSelector follows the JMS specification.threadContext
- context in which the method is called- Throws:
ListenerException
- See Also:
-
canGoOn
protected boolean canGoOn() -
SetRunStateEnquirer
- Specified by:
SetRunStateEnquirer
in interfaceRunStateEnquiring
-