Package org.frankframework.jms
Class AbstractJmsListener
java.lang.Object
org.frankframework.jndi.JndiBase
org.frankframework.jms.JMSFacade
org.frankframework.jms.AbstractJmsListener
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,HasSender,IConfigurable,IListener<jakarta.jms.Message>,IRedeliveringListener<jakarta.jms.Message>,IScopeProvider,IWithParameters,IXAEnabled,NameAware,ConfigurableLifecycle,ReceiverAware<jakarta.jms.Message>,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
- Direct Known Subclasses:
PullingJmsListener,PushingJmsListener
public abstract class AbstractJmsListener
extends JMSFacade
implements HasSender, IWithParameters, IRedeliveringListener<jakarta.jms.Message>, ReceiverAware<jakarta.jms.Message>
- Since:
- 4.9
- 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 TypeMethodDescriptionvoidvoidafterMessageProcessed(PipeLineResult plr, RawMessageWrapper<jakarta.jms.Message> rawMessageWrapper, PipeLineSession session) Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.voidConfigure this component.extractMessage(RawMessageWrapper<jakarta.jms.Message> rawMessage, Map<String, Object> context) Extracts data from message obtained fromIPullingListener.getRawMessage(Map).extractMessageProperties(jakarta.jms.Message rawMessage) Fill in thread-context with things needed by the JMSListener code.getMessageProperties(PipeLineSession session) Set additional message headers/properties on the JMS response, read after message has been processed!return the ParametersbooleanprepareReply(Message rawReply, Map<String, Object> threadContext) protected voidsendReply(PipeLineResult plr, jakarta.jms.Destination replyTo, String replyCid, long timeToLive, boolean ignoreInvalidDestinationException, PipeLineSession pipeLineSession, Map<String, Object> properties) voidBy default, the JmsListener takes the Correlation-ID (if present) as the ID that has to be used as Correlation-ID of the reply.voidsetReplyDeliveryMode(JMSFacade.DeliveryMode replyDeliveryMode) Controls mode that reply messages are sent withvoidsetReplyDestinationName(String destinationName) Name of the JMS destination (queue or topic) to use for sending replies.voidsetReplyEncodingStyleURI(String string) voidsetReplyMessageTimeToLive(long l) Time in milliseconds after which the reply-message will expirevoidsetReplyMessageType(String string) Value of the JMSType field of the reply messagevoidsetReplyNamespaceURI(String string) voidsetReplyPriority(int i) Sets the priority that is used to deliver the reply message.voidsetReplySoapAction(String string) voidDeprecated, for removal: This API element is subject to removal in a future version.voidsetSoap(boolean b) Iftrue, messages sent are put in a SOAP envelopevoidsetSoapHeaderSessionKey(String string) sessionKey to store the SOAP header of the incoming messagevoidsetTimeout(long newTimeout) Receive timeout in milliseconds as specified by the JMS API, see https://docs.oracle.com/javaee/7/api/javax/jms/MessageConsumer.html#receive-long-voidsetUseReplyTo(boolean newUseReplyTo) Flag if reply-to queue from the request message should be used or not.voidstart()Obtains a connection and a serviceQueue.voidstop()Releases references to serviceQueue and connection.Methods 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.IXAEnabled
isTransactedMethods inherited from interface org.frankframework.receivers.ReceiverAware
getReceiver, setReceiverMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Constructor Details
-
AbstractJmsListener
public AbstractJmsListener()
-
-
Method Details
-
configure
Description copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configurein interfaceIConfigurable- Overrides:
configurein classJMSFacade- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from class:JMSFacadeObtains a connection and a serviceQueue. -
stop
public void stop()Description copied from class:JMSFacadeReleases references to serviceQueue and connection. -
extractMessageProperties
Fill in thread-context with things needed by the JMSListener code. This includes a Session. The Session object can be passed in externally.- Parameters:
rawMessage- - Original message received, can not benull- Returns:
- A
Mapwith the properties of the JMSMessage.
-
extractMessage
public Message extractMessage(@Nonnull RawMessageWrapper<jakarta.jms.Message> rawMessage, @Nonnull Map<String, Object> context) throws ListenerExceptionExtracts data from message obtained fromIPullingListener.getRawMessage(Map). May also extract other parameters from the message and put those in the context.- Specified by:
extractMessagein interfaceIListener<jakarta.jms.Message>- Parameters:
rawMessage- TheRawMessageWrapperfrom which to extract theMessage.context- Context to populate. Either aPipeLineSessionor athreadContextdepending on caller.- Returns:
- String input
Messagefor adapter. - Throws:
ListenerException
-
prepareReply
public Message prepareReply(Message rawReply, Map<String, Object> threadContext) throws ListenerException- Throws:
ListenerException
-
prepareReply
public Message prepareReply(Message rawReply, Map<String, Object> threadContext, String soapHeader) throws ListenerException- Throws:
ListenerException
-
afterMessageProcessed
public void afterMessageProcessed(PipeLineResult plr, RawMessageWrapper<jakarta.jms.Message> rawMessageWrapper, PipeLineSession session) 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>- Throws:
ListenerException
-
messageWillBeRedeliveredOnExitStateError
public boolean messageWillBeRedeliveredOnExitStateError()- Specified by:
messageWillBeRedeliveredOnExitStateErrorin interfaceIRedeliveringListener<jakarta.jms.Message>
-
sendReply
protected void sendReply(PipeLineResult plr, jakarta.jms.Destination replyTo, String replyCid, long timeToLive, boolean ignoreInvalidDestinationException, PipeLineSession pipeLineSession, Map<String, Object> properties) throws ListenerException, jakarta.jms.JMSException, IOException, SenderException- Throws:
ListenerExceptionjakarta.jms.JMSExceptionIOExceptionSenderException
-
setSender
Deprecated, for removal: This API element is subject to removal in a future version. -
getMessageProperties
Set additional message headers/properties on the JMS response, read after message has been processed!- Parameters:
session- which has been built during the pipeline- Returns:
- a map with headers to set to the JMS response, or
nullif there was no session or no parameters.
-
addParameter
- Specified by:
addParameterin interfaceIWithParameters
-
getParameterList
return the Parameters- Specified by:
getParameterListin interfaceIWithParameters
-
setForceMessageIdAsCorrelationId
By default, the JmsListener takes the Correlation-ID (if present) as the ID that has to be used as Correlation-ID of the reply. When set totrue, the messageID is used as Correlation-ID of the reply.- Default value
- false
-
setTimeout
public void setTimeout(long newTimeout) Receive timeout in milliseconds as specified by the JMS API, see https://docs.oracle.com/javaee/7/api/javax/jms/MessageConsumer.html#receive-long-- Default value
- 1000
-
setUseReplyTo
public void setUseReplyTo(boolean newUseReplyTo) Flag if reply-to queue from the request message should be used or not.- Default value
- true
-
setReplyDestinationName
Name of the JMS destination (queue or topic) to use for sending replies. IfuseReplyTo=true, the sender specified reply destination takes precedence over this one. -
setReplyMessageType
Value of the JMSType field of the reply message- Default value
- not set by application
-
setReplyDeliveryMode
Controls mode that reply messages are sent with- Default value
- NON_PERSISTENT
-
setReplyPriority
public void setReplyPriority(int i) Sets the priority that is used to deliver the reply message. Ranges from 0 to 9. Effectively the default priority is set by JMS to 4,-1means not set and thus uses the JMS default- Default value
- -1
-
setReplyMessageTimeToLive
public void setReplyMessageTimeToLive(long l) Time in milliseconds after which the reply-message will expire- Default value
- 0
-
setSoap
public void setSoap(boolean b) Iftrue, messages sent are put in a SOAP envelope- Default value
- false
-
setReplyEncodingStyleURI
-
setReplyNamespaceURI
-
setReplySoapAction
-
setSoapHeaderSessionKey
sessionKey to store the SOAP header of the incoming message- Default value
- soapHeader
-