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 long
static final long
Fields inherited from class org.frankframework.senders.AbstractSenderWithParameters
parameterNamesMustBeUnique, paramList
Fields inherited from class org.frankframework.senders.AbstractSender
log
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure this component.sendMessage
(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).void
setAddress
(String address) Set the address (name of the queue or topic) on which to send messagesvoid
setAddressType
(AddressType addressType) Set the type of address to which messages are being sent, TOPIC or QUEUE.void
setConnectionName
(String connectionName) void
setDeliveryMode
(org.apache.qpid.protonj2.client.DeliveryMode deliveryMode) DeliveryMode: AT_LEAST_ONCE or AT_MOST_ONCE.void
setDurable
(boolean durable) void
setMessageProtocol
(MessageProtocol messageProtocol) Send message as Fire-and-Forget, or as Request-Replyvoid
setMessageType
(AmqpSender.MessageType messageType) Set the message type:AmqpSender.MessageType.TEXT
to character data to be sent asAmqpValue
section,AmqpSender.MessageType.BINARY
for binary data to be sent as AMQPData
section, orAmqpSender.MessageType.AUTO
to decide automatically based on the wether the inputMessage
is binary or not.void
setStreamingMessages
(boolean streamingMessages) Set if messages should be created as streaming messages.void
setTimeout
(long timeout) Timeout in seconds for sending messages and receiving replies.void
setTimeToLive
(long timeToLive) Set the message time-to-live, in milliseconds.void
start()
This method will be called to start the sender.void
stop()
Stop/close the sender and deallocate resources.Methods inherited from class org.frankframework.senders.AbstractSenderWithParameters
addParameter, checkStringAttributeOrParameter, consumesSessionVariable, getParameterList, getParameterOverriddenAttributeValue, getParameterOverriddenAttributeValue, getParameterValueList
Methods inherited from class org.frankframework.senders.AbstractSender
createBean, getLogPrefix, getName, isRunning, setApplicationContext, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
Methods inherited from interface org.frankframework.core.HasApplicationContext
getApplicationContext, getConfigurationClassLoader
Methods inherited from interface org.frankframework.core.ISender
isSynchronous, sendMessageOrThrow
Methods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariable
Methods 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:IConfigurable
Configure 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:
configure
in interfaceIConfigurable
- Overrides:
configure
in classAbstractSenderWithParameters
- Throws:
ConfigurationException
- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:ISender
This 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:
start
in interfaceISender
- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- Overrides:
start
in classAbstractSender
-
stop
public void stop()Description copied from interface:ISender
Stop/close the sender and deallocate resources.- Specified by:
stop
in interfaceISender
- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
- Overrides:
stop
in classAbstractSender
-
getPhysicalDestinationName
- Specified by:
getPhysicalDestinationName
in interfaceHasPhysicalDestination
-
sendMessage
@Nonnull public SenderResult sendMessage(@Nonnull Message message, @Nonnull PipeLineSession session) throws SenderException, TimeoutException Description copied from interface:ISender
Send 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()
returnstrue
false
return 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:
sendMessage
in interfaceISender
- Throws:
SenderException
TimeoutException
-
setConnectionName
-
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. -
setAddress
Set the address (name of the queue or topic) on which to send messages -
setMessageType
Set the message type:AmqpSender.MessageType.TEXT
to character data to be sent asAmqpValue
section,AmqpSender.MessageType.BINARY
for binary data to be sent as AMQPData
section, orAmqpSender.MessageType.AUTO
to decide automatically based on the wether the inputMessage
is 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.BINARY
message.
WhensetStreamingMessages(boolean)
is configured true, themessageType
is 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 AMQPBody
section. -
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
-