Package org.frankframework.jdbc
Class MessageStoreSender
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,IConfigurable,IMessageBrowser<Serializable>,IScopeProvider,ISender,ISenderWithParameters,ITransactionalStorage<Serializable>,IWithParameters,IXAEnabled,NameAware,ConfigurableLifecycle,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
@ExcludeFromType(ITransactionalStorage.class)
public class MessageStoreSender
extends JdbcTransactionalStorage<Serializable>
implements ISenderWithParameters
Send messages to the IBISSTORE database table to have them processed exactly-once by another
adapter which will read the messages using a
If you have a
Example configuration:
MessageStoreListener.
This other adapter will process the messages asynchronously and (optionally)
under transaction control. Duplicate messages are ignored based on the
messageId (except when onlyStoreWhenMessageIdUnique is set to false), hence
the sender of the message can retry sending the message until a valid reply
is received in which case it can be certain that the message is stored in the
database table IBISSTORE.
If you have a
MessageStoreSender it does not make sense to add a JdbcMessageLog
or JdbcErrorStorage in the same sender pipe. A MessageStoreSender
acts as a message log and an error store. It can be useful however to add a message log or error store
to the adapter around the sender pipe, because errors may occur before the message reaches the sender pipe.
Example configuration:
<SenderPipe name="Send">
<MessageStoreSender
slotId="${instance.name}/TestMessageStore"
onlyStoreWhenMessageIdUnique="false" />
</SenderPipe>
- Author:
- Jaco de Groot
- Specific parameters
- messageId messageId to check for duplicates, when this parameter isn't present the messageId is read from sessionKey messageId
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.frankframework.core.IMessageBrowser
IMessageBrowser.HideMethod, IMessageBrowser.SortOrder, IMessageBrowser.StorageType -
Field Summary
FieldsFields inherited from class org.frankframework.jdbc.JdbcTransactionalStorage
insertQuery, MAXCIDLEN, MAXIDLEN, MAXLABELLEN, selectKeyForMessageQuery, txManagerFields inherited from class org.frankframework.jdbc.JdbcTableMessageBrowser
useIndexHintFields inherited from class org.frankframework.jdbc.AbstractJdbcMessageBrowser
checkCorrelationIdQuery, checkMessageIdQuery, CONTROL_PROPERTY_PREFIX, deleteQuery, getMessageCountQuery, PROPERTY_ASSUME_PRIMARY_KEY_UNIQUE, PROPERTY_USE_PARAMETERS, selectContextQuery, selectDataQueryFields inherited from class org.frankframework.jdbc.JdbcFacade
logFields inherited from interface org.frankframework.core.ITransactionalStorage
MAXCOMMENTLENFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidCreates a connection, checks if the table is existing and creates it when necessarybooleanWhentrue, the result of sendMessage is the reply of the request.sendMessage(Message message, PipeLineSession session) Send a message to some destination (as configured in the Sender object).voidsetOnlyStoreWhenMessageIdUnique(boolean onlyStoreWhenMessageIdUnique) If set totrue, the message is stored only if the MessageId is not present in the store yet.voidsetSessionKeys(String sessionKeys) Comma separated list of sessionKey's to be stored together with the message.voidSet the slotId, an identifier to keep separate the messages inserted by different MessageStoreSenders.Methods inherited from class org.frankframework.jdbc.JdbcTransactionalStorage
consumeMessage, createQueryTexts, createStorage, getLogPrefix, getStorageRefKey, initialize, retrieveObject, setBlobsCompressed, setCheckTable, setCreateTable, setDataTypes, setDateFieldType, setHostField, setKeyFieldType, setMessageFieldType, setOperationControls, setRetention, setSchemaOwner4Check, setSequenceName, setSlotIdField, setStoreFullMessage, setTextFieldType, setType, setTypeField, start, storeMessage, storeMessage, storeMessageInDatabaseMethods inherited from class org.frankframework.jdbc.JdbcTableMessageBrowser
createSelector, getFromClause, getPhysicalDestinationName, getSelectListQuery, getStorageFields, provideFirstRowsHintAfterFirstKeyword, provideIndexHintAfterFirstKeyword, provideTrailingFirstRowsHint, setIndexName, setTableNameMethods inherited from class org.frankframework.jdbc.AbstractJdbcMessageBrowser
applyStandardParameters, applyStandardParameters, browseMessage, containsCorrelationId, containsMessageId, copyFacadeSettings, deleteMessage, getContext, getDatasource, getIterator, getIterator, getMessageCount, getWhereClause, setCommentField, setCorrelationIdField, setDateField, setExpiryDateField, setIdField, setKeyField, setLabelField, setMessageField, setOrder, setPrefixMethods inherited from class org.frankframework.jdbc.JdbcFacade
getConnection, getConnectionWithTimeout, getDatasourceName, getDbmsSupport, getPassword, isConnectionsArePooled, isRunning, isTransacted, setAuthAlias, setConnectionsArePooled, setDatasourceName, setDbmsSupportFactory, setName, setPassword, setTransacted, setUsername, stopMethods 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.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.IMessageBrowser
browseMessage, containsCorrelationId, containsMessageId, deleteMessage, getContext, getHideMethod, getHideRegex, getIterator, getIterator, getMessageCount, getStorageFields, setHideMethod, setHideRegexMethods inherited from interface org.frankframework.core.ISender
sendMessageOrThrow, start, stopMethods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariableMethods inherited from interface org.frankframework.core.ITransactionalStorage
getSlotId, getType, stopMethods inherited from interface org.frankframework.core.IXAEnabled
isTransactedMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
PARAM_MESSAGEID
- See Also:
-
-
Constructor Details
-
MessageStoreSender
public MessageStoreSender()
-
-
Method Details
-
configure
Description copied from class:JdbcTransactionalStorageCreates a connection, checks if the table is existing and creates it when necessary- Specified by:
configurein interfaceIConfigurable- Specified by:
configurein interfaceITransactionalStorage<Serializable>- Overrides:
configurein classJdbcTransactionalStorage<Serializable>- Throws:
ConfigurationException- in case it was not able to configure the component.
-
isSynchronous
public boolean isSynchronous()Description copied from interface:ISenderWhentrue, the result of sendMessage is the reply of the request.- Specified by:
isSynchronousin interfaceISender
-
addParameter
- Specified by:
addParameterin interfaceIWithParameters
-
getParameterList
- Specified by:
getParameterListin interfaceIWithParameters
-
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
-
setSessionKeys
Comma separated list of sessionKey's to be stored together with the message. Please note: correspondingMessageStoreListenermust have the same value for this attribute. -
setOnlyStoreWhenMessageIdUnique
public void setOnlyStoreWhenMessageIdUnique(boolean onlyStoreWhenMessageIdUnique) If set totrue, the message is stored only if the MessageId is not present in the store yet.- Overrides:
setOnlyStoreWhenMessageIdUniquein classJdbcTransactionalStorage<Serializable>- Default value
true
-
setSlotId
Set the slotId, an identifier to keep separate the messages inserted by different MessageStoreSenders.
This field should be set.- Specified by:
setSlotIdin interfaceITransactionalStorage<Serializable>- Overrides:
setSlotIdin classJdbcTransactionalStorage<Serializable>- Parameters:
string- TheslotIDvalue for this MessageStoreSender.
-