Class PullingJmsListener
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,HasSender,IConfigurable,ICorrelatedPullingListener<jakarta.jms.Message>,IListener<jakarta.jms.Message>,IPullingListener<jakarta.jms.Message>,IRedeliveringListener<jakarta.jms.Message>,IScopeProvider,IWithParameters,IXAEnabled,NameAware,ConfigurableLifecycle,ReceiverAware<jakarta.jms.Message>,RunStateEnquiring,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
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.
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
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.TextMessages
- 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.JmsDestinationType, JMSFacade.MessageClass, JMSFacade.SubscriberType -
Field Summary
Fields inherited from class org.frankframework.jms.JMSFacade
JMS_MESSAGECLASS_KEY, log, messagingSourceFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterMessageProcessed(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 booleancanGoOn()voidcloseThread(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.MessageConsumergetReceiver(Map<String, Object> threadContext, jakarta.jms.Session session, String correlationId) protected jakarta.jms.SessiongetSession(Map<String, Object> threadContext) Prepares a thread for receiving messages.protected voidreleaseReceiver(jakarta.jms.MessageConsumer receiver, String correlationId) protected voidreleaseSession(jakarta.jms.Session session) protected voidsendReply(PipeLineResult plr, jakarta.jms.Destination replyTo, String replyCid, long timeToLive, boolean ignoreInvalidDestinationException, PipeLineSession pipeLineSession, Map<String, Object> properties) voidSetRunStateEnquirer(RunStateEnquirer enquirer) Methods inherited from class org.frankframework.jms.AbstractJmsListener
addParameter, configure, extractMessage, extractMessageProperties, getMessageProperties, getParameterList, messageWillBeRedeliveredOnExitStateError, prepareReply, prepareReply, setForceMessageIdAsCorrelationId, setReplyDeliveryMode, setReplyDestinationName, setReplyEncodingStyleURI, setReplyMessageTimeToLive, setReplyMessageType, setReplyNamespaceURI, setReplyPriority, setReplySoapAction, setSender, setSoap, setSoapHeaderSessionKey, setTimeout, setUseReplyTo, start, stopMethods inherited from class org.frankframework.jms.JMSFacade
checkTransactionManagerValidity, closeSession, createBytesMessage, createMessage, createMessage, createSession, createTextMessage, extractMessage, extractMessageBody, getConnectionFactoryName, getContext, getDestination, getDestination, getJmsMessagingSource, getLogPrefix, getMessageConsumer, getMessageConsumer, getMessageConsumerForCorrelationId, getMessageProducer, getMessagingSource, getPhysicalDestinationName, getPhysicalDestinationShortName, getPhysicalDestinationShortName, isRunning, isSessionsArePooled, logMessageDetails, send, send, send, send, send, sendByQueue, sendByTopic, setAcknowledgeMode, setAuthAlias, setCorrelationIdMaxLength, setCorrelationIdToHex, setCorrelationIdToHexPrefix, setDestinationName, setDestinationType, setJndiContextPrefix, setLookupDestination, setMessageClass, setMessageCorrelationID, setMessageSelector, setMessageTimeToLive, setName, setPersistent, setQueueConnectionFactoryName, setSubscriberType, setTopicConnectionFactoryName, setTransacted, toStringMethods inherited from class org.frankframework.jndi.JndiBase
getContext, getJndiEnv, setAuthentication, setCredentials, setInitialContextFactoryName, setJmsRealm, setJndiAuthAlias, setJndiProperties, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.lifecycle.ConfigurableLifecycle
getPhase, isAutoStartup, isConfiguredMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.IConfigurable
configureMethods inherited from interface org.frankframework.core.IListener
extractMessage, start, stopMethods inherited from interface org.frankframework.core.IXAEnabled
isTransactedMethods inherited from interface org.frankframework.receivers.ReceiverAware
getReceiver, setReceiverMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
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:IPullingListenerPrepares a thread for receiving messages. Called once for each thread that will listen for messages.- Specified by:
openThreadin 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:IPullingListenerFinalizes a message receiving thread. Called once for each thread that listens for messages, just beforeIListener.stop()is called.- Specified by:
closeThreadin 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:IListenerCalled to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.- Specified by:
afterMessageProcessedin interfaceIListener<jakarta.jms.Message>- Overrides:
afterMessageProcessedin 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:
sendReplyin classAbstractJmsListener- Throws:
SenderExceptionListenerExceptionjakarta.jms.JMSExceptionIOException
-
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:
getRawMessagein 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:ICorrelatedPullingListenerRetrieves messages from queue or other channel, but retrieves only messages with the specified correlationId.- Specified by:
getRawMessagein interfaceICorrelatedPullingListener<jakarta.jms.Message>- Throws:
ListenerExceptionTimeoutException
-
canGoOn
protected boolean canGoOn() -
SetRunStateEnquirer
- Specified by:
SetRunStateEnquirerin interfaceRunStateEnquiring
-