Class PushingJmsListener
- All Implemented Interfaces:
HasPhysicalDestination
,HasSender
,IConfigurable
,IConfigurationAware
,IKnowsDeliveryCount<jakarta.jms.Message>
,IListener<jakarta.jms.Message>
,INamedObject
,IPortConnectedListener<jakarta.jms.Message>
,IPushingListener<jakarta.jms.Message>
,IRedeliveringListener<jakarta.jms.Message>
,IScopeProvider
,IThreadCountControllable
,IWithParameters
,IXAEnabled
,ReceiverAware<jakarta.jms.Message>
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
JmsListener
JmsListener
supports distributed transactions using the XA-protocol.
No special action is required to have the listener join the transaction.
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, set
transacted
="true" for the enclosing Receiver. Do not use jmsTransacted for any new situation.
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
TextMessage
s and BytesMessage
- Since:
- 4.8
- Author:
- Tim van der Leeuw
-
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
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener.void
int
int
getDeliveryCount
(RawMessageWrapper<jakarta.jms.Message> rawMessage) IMessageHandler<jakarta.jms.Message>
IListenerConnector<jakarta.jms.Message>
int
long
Receiver<jakarta.jms.Message>
void
boolean
boolean
void
setCacheMode
(IListenerConnector.CacheMode cacheMode) void
setDestinationName
(String destinationName) Name of the JMS destination (queue or topic) to usevoid
setExceptionListener
(IbisExceptionListener exceptionListener) Set a (single) listener that will be notified of any exceptions.void
setHandler
(IMessageHandler<jakarta.jms.Message> handler) Set the handler that will do the processing of the message.void
setJmsConnector
(IListenerConnector<jakarta.jms.Message> jmsConnector) void
setPollGuardInterval
(long pollGuardInterval) Interval in milliseconds for the poll guard to check whether a successful poll was done by the receive (https://docs.oracle.com/javaee/7/api/javax/jms/messageconsumer.html#receive-long-) since last check.void
setReceiver
(Receiver<jakarta.jms.Message> receiver) void
start()
Obtains a connection and a serviceQueue.void
stop()
Releases references to serviceQueue and connection.RawMessageWrapper<jakarta.jms.Message>
wrapRawMessage
(jakarta.jms.Message rawMessage, PipeLineSession session) Wrap a raw message in a MessageWrapper.Methods inherited from class org.frankframework.jms.AbstractJmsListener
addParameter, afterMessageProcessed, extractMessage, extractMessageProperties, getForceMessageIdAsCorrelationId, getMessageProperties, getParameterList, getReplyDeliveryMode, getReplyDestinationName, getReplyEncodingStyleURI, getReplyMessageTimeToLive, getReplyMessageType, getReplyNamespaceURI, getReplyPriority, getReplySoapAction, getSender, getSoapHeaderSessionKey, getTimeout, isSoap, isUseReplyTo, messageWillBeRedeliveredOnExitStateError, prepareReply, prepareReply, sendReply, setForceMessageIdAsCorrelationId, setReplyDeliveryMode, setReplyDestinationName, setReplyEncodingStyleURI, setReplyMessageTimeToLive, setReplyMessageType, setReplyNamespaceURI, setReplyPriority, setReplySoapAction, setSender, setSoap, setSoapHeaderSessionKey, setTimeout, setUseReplyTo
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, 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
afterMessageProcessed, extractMessage
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IPortConnectedListener
checkTransactionManagerValidity
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
-
Constructor Details
-
PushingJmsListener
public PushingJmsListener()
-
-
Method Details
-
configure
Description copied from interface:IListener
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener. Purpose of this method is to reduce creating connections to databases etc. in theIPullingListener.getRawMessage(Map)
method. As much as possible class-instantiating should take place in theconfigure()
orIListener.start()
method, to improve performance.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIListener<jakarta.jms.Message>
- Overrides:
configure
in classAbstractJmsListener
- Throws:
ConfigurationException
-
start
public void start()Description copied from class:JMSFacade
Obtains a connection and a serviceQueue.- Specified by:
start
in interfaceIListener<jakarta.jms.Message>
- Overrides:
start
in classAbstractJmsListener
-
stop
public void stop()Description copied from class:JMSFacade
Releases references to serviceQueue and connection.- Specified by:
stop
in interfaceIListener<jakarta.jms.Message>
- Overrides:
stop
in classAbstractJmsListener
-
wrapRawMessage
public RawMessageWrapper<jakarta.jms.Message> wrapRawMessage(jakarta.jms.Message rawMessage, PipeLineSession session) throws ListenerException Description copied from interface:IPushingListener
Wrap a raw message in a MessageWrapper. PopulatePipeLineSession
with properties from the message.- Specified by:
wrapRawMessage
in interfaceIPushingListener<jakarta.jms.Message>
- Parameters:
rawMessage
- The raw message data, unwrappedsession
-PipeLineSession
to populate with properties from the message.- Returns:
- Wrapped raw message
- Throws:
ListenerException
- If any exception occurs during wrapping, aListenerException
is thrown.
-
isThreadCountReadable
public boolean isThreadCountReadable()- Specified by:
isThreadCountReadable
in interfaceIThreadCountControllable
-
isThreadCountControllable
public boolean isThreadCountControllable()- Specified by:
isThreadCountControllable
in interfaceIThreadCountControllable
-
getCurrentThreadCount
public int getCurrentThreadCount()- Specified by:
getCurrentThreadCount
in interfaceIThreadCountControllable
-
getMaxThreadCount
public int getMaxThreadCount()- Specified by:
getMaxThreadCount
in interfaceIThreadCountControllable
-
increaseThreadCount
public void increaseThreadCount()- Specified by:
increaseThreadCount
in interfaceIThreadCountControllable
-
decreaseThreadCount
public void decreaseThreadCount()- Specified by:
decreaseThreadCount
in interfaceIThreadCountControllable
-
getDeliveryCount
- Specified by:
getDeliveryCount
in interfaceIKnowsDeliveryCount<jakarta.jms.Message>
-
setDestinationName
Description copied from class:JMSFacade
Name of the JMS destination (queue or topic) to use- Overrides:
setDestinationName
in classJMSFacade
-
setCacheMode
-
setPollGuardInterval
public void setPollGuardInterval(long pollGuardInterval) Interval in milliseconds for the poll guard to check whether a successful poll was done by the receive (https://docs.oracle.com/javaee/7/api/javax/jms/messageconsumer.html#receive-long-) since last check. If polling has stopped this will be logged and the listener will be stopped and started in an attempt to workaround problems with polling. Polling might stop due to bugs in the JMS driver/implementation which should be fixed by the supplier. As the poll time includes reading and processing of the message no successful poll might be registered since the last check when message processing takes a long time, hence while messages are being processed the check on last successful poll will be skipped. Set to -1 to disable.- Default value
- ten times the specified timeout
-
getCacheMode
-
getPollGuardInterval
public long getPollGuardInterval() -
getJmsConnector
-
setJmsConnector
-
getHandler
- Specified by:
getHandler
in interfaceIPortConnectedListener<jakarta.jms.Message>
-
setHandler
Description copied from interface:IPushingListener
Set the handler that will do the processing of the message. Each of the received messages must be pushed through handler.processMessage()- Specified by:
setHandler
in interfaceIPushingListener<jakarta.jms.Message>
-
getReceiver
- Specified by:
getReceiver
in interfaceReceiverAware<jakarta.jms.Message>
-
setReceiver
- Specified by:
setReceiver
in interfaceReceiverAware<jakarta.jms.Message>
-
getExceptionListener
- Specified by:
getExceptionListener
in interfaceIPortConnectedListener<jakarta.jms.Message>
-
setExceptionListener
Description copied from interface:IPushingListener
Set a (single) listener that will be notified of any exceptions. The listener should use this listener to notify the receiver of any exception that occurs outside the processing of a message.- Specified by:
setExceptionListener
in interfaceIPushingListener<jakarta.jms.Message>
-