Class AmqpSender
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,IConfigurable,IScopeProvider,ISender,ISenderWithParameters,IWithParameters,NameAware,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longFields inherited from class org.frankframework.senders.AbstractSenderWithParameters
parameterNamesMustBeUnique, paramListFields inherited from class org.frankframework.senders.AbstractSender
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConfigure this component.sendMessage(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).voidsetAddress(String address) Set the address (name of the queue or topic) on which to send messages.voidsetAddressType(AddressType addressType) Set the type of address to which messages are being sent, TOPIC or QUEUE.voidsetConnectionName(String connectionName) Name of the AMQP connection in the amqp section of theresources.yamlfile.voidsetDeliveryMode(org.apache.qpid.protonj2.client.DeliveryMode deliveryMode) DeliveryMode: AT_LEAST_ONCE or AT_MOST_ONCE.voidsetDurable(boolean durable) voidsetMessageProtocol(MessageProtocol messageProtocol) Send message as Fire-and-Forget, or as Request-ReplyvoidsetMessageType(AmqpSender.MessageType messageType) Set the message type:AmqpSender.MessageType.TEXTto character data to be sent asAmqpValuesection,AmqpSender.MessageType.BINARYfor binary data to be sent as AMQPDatasection, orAmqpSender.MessageType.AUTOto decide automatically based on the wether the inputMessageis binary or not.voidsetStreamingMessages(boolean streamingMessages) Set if messages should be created as streaming messages.voidsetTimeout(long timeout) Timeout in seconds for sending messages and receiving replies.voidsetTimeToLive(long timeToLive) Set the message time-to-live, in milliseconds.voidstart()This method will be called to start the sender.voidstop()Stop/close the sender and deallocate resources.Methods inherited from class org.frankframework.senders.AbstractSenderWithParameters
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueListMethods inherited from class org.frankframework.senders.AbstractSender
createBean, getLogPrefix, getName, isRunning, setApplicationContext, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface org.frankframework.core.FrankElement
addConfigWarningMethods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface org.frankframework.core.ISender
isSynchronous, sendMessageOrThrowMethods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariableMethods inherited from interface org.frankframework.core.IWithParameters
addParameter, getParameterList
-
Field Details
-
DEFAULT_TIMEOUT_SECONDS
public static final long DEFAULT_TIMEOUT_SECONDS- See Also:
-
DEFAULT_TIME_TO_LIVE
public static final long DEFAULT_TIME_TO_LIVE
-
-
Constructor Details
-
AmqpSender
public AmqpSender()
-
-
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 classAbstractSenderWithParameters- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:ISenderThis method will be called to start the sender. After this method is called the sendMessage method may be called. Purpose of this method is to reduce creating connections to databases etc. in thesendMessage()method.- Specified by:
startin interfaceISender- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Overrides:
startin classAbstractSender
-
stop
public void stop()Description copied from interface:ISenderStop/close the sender and deallocate resources.- Specified by:
stopin interfaceISender- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Overrides:
stopin classAbstractSender
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination
-
sendMessage
@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException Description copied from interface:ISenderSend a message to some destination (as configured in the Sender object). This method may only be called after theconfigure()method is called.The following table shows the difference between synchronous and a-synchronous senders:
synchronous a-synchronous ISender.isSynchronous()returnstruefalsereturn value of sendMessage()isthe reply-message the messageId of the message sent the correlationID specified with sendMessage()may be ignored is sent with the message a {link TimeOutException} may be thrown if a timeout occurs waiting for a reply should not be expected Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, or
synchronized.- Specified by:
sendMessagein interfaceISender- Throws:
SenderExceptionTimeoutException
-
setConnectionName
Name of the AMQP connection in the amqp section of theresources.yamlfile. -
setTimeout
public void setTimeout(long timeout) Timeout in seconds for sending messages and receiving replies.- Default value
- 30L
-
setAddressType
Set the type of address to which messages are being sent, TOPIC or QUEUE. For MessageProtocol#RR the type will always be QUEUE.- Default value
- QUEUE
-
setAddress
Set the address (name of the queue or topic) on which to send messages. -
setMessageType
Set the message type:AmqpSender.MessageType.TEXTto character data to be sent asAmqpValuesection,AmqpSender.MessageType.BINARYfor binary data to be sent as AMQPDatasection, orAmqpSender.MessageType.AUTOto decide automatically based on the wether the inputMessageis binary or not.When a message is to be received as a streaming message by the recipient, it has to be sent as a
AmqpSender.MessageType.BINARYmessage.
WhensetStreamingMessages(boolean)is configured true, themessageTypeis ignored.- Default value
- AUTO
-
setStreamingMessages
public void setStreamingMessages(boolean streamingMessages) Set if messages should be created as streaming messages. Streaming messages are always sent as binary messages, with an AMQPBodysection. -
setDurable
public void setDurable(boolean durable) -
setTimeToLive
public void setTimeToLive(long timeToLive) Set the message time-to-live, in milliseconds.- Default value
- -1ms, meaning no expiry.
-
setDeliveryMode
public void setDeliveryMode(org.apache.qpid.protonj2.client.DeliveryMode deliveryMode) DeliveryMode: AT_LEAST_ONCE or AT_MOST_ONCE.- Default value
- AT_LEAST_ONCE
-
setMessageProtocol
Send message as Fire-and-Forget, or as Request-Reply- Parameters:
messageProtocol- FF for Fire-and-Forget, or RR for Request-Reply.- Default value
- FF
-