Package org.frankframework.jdbc
Class MessageStoreSender
java.lang.Object
- All Implemented Interfaces:
HasPhysicalDestination
,IConfigurable
,IConfigurationAware
,IMessageBrowser<String>
,INamedObject
,IScopeProvider
,ISender
,ISenderWithParameters
,ITransactionalStorage<String>
,IWithParameters
,IXAEnabled
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@ExcludeFromType(ITransactionalStorage.class)
public class MessageStoreSender
extends JdbcTransactionalStorage<String>
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
Fields inherited from class org.frankframework.jdbc.JdbcTransactionalStorage
insertQuery, MAXCIDLEN, MAXIDLEN, MAXLABELLEN, selectKeyForMessageQuery, txManager
Fields inherited from class org.frankframework.jdbc.JdbcTableMessageBrowser
useIndexHint
Fields inherited from class org.frankframework.jdbc.AbstractJdbcMessageBrowser
checkCorrelationIdQuery, checkMessageIdQuery, CONTROL_PROPERTY_PREFIX, deleteQuery, getMessageCountQuery, PROPERTY_ASSUME_PRIMARY_KEY_UNIQUE, PROPERTY_USE_PARAMETERS, selectContextQuery, selectDataQuery
Fields inherited from interface org.frankframework.core.ITransactionalStorage
MAXCOMMENTLEN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Creates a connection, checks if the table is existing and creates it when necessaryboolean
Whentrue
, 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).void
setOnlyStoreWhenMessageIdUnique
(boolean onlyStoreWhenMessageIdUnique) If set totrue
, the message is stored only if the MessageId is not present in the store yet.void
setSessionKeys
(String sessionKeys) Comma separated list of sessionKey's to be stored together with the message.void
Set the slotId, an identifier to keep separate the messages inserted by different MessageStoreSenders.Methods inherited from class org.frankframework.jdbc.JdbcTransactionalStorage
createQueryTexts, createStorage, getDateFieldType, getKeyFieldType, getLogPrefix, getMessage, getMessageFieldType, getRetention, getSchemaOwner4Check, getSequenceName, getStorageRefKey, getTextFieldType, getTxManager, initialize, isBlobsCompressed, isCheckIndices, isCheckTable, isCreateTable, isOnlyStoreWhenMessageIdUnique, isStoreFullMessage, retrieveObject, setBlobsCompressed, setCheckIfTableExists, setCheckTable, setCreateTable, setDataTypes, setDateFieldType, setHostField, setKeyFieldType, setMessageFieldType, setOperationControls, setRetention, setSchemaOwner4Check, setSequenceName, setSlotIdField, setStoreFullMessage, setTextFieldType, setTxManager, setType, setTypeField, start, storeMessage, storeMessage, storeMessageInDatabase
Methods inherited from class org.frankframework.jdbc.JdbcTableMessageBrowser
createSelector, getFromClause, getIndexName, getPhysicalDestinationName, getSelectListQuery, getTableName, provideFirstRowsHintAfterFirstKeyword, provideIndexHintAfterFirstKeyword, provideTrailingFirstRowsHint, setIndexName, setTableName
Methods inherited from class org.frankframework.jdbc.AbstractJdbcMessageBrowser
applyStandardParameters, applyStandardParameters, browseMessage, containsCorrelationId, containsMessageId, copyFacadeSettings, deleteMessage, getCommentField, getContext, getCorrelationIdField, getDatasource, getDateField, getExpiryDateField, getHideMethod, getHideRegex, getHostField, getIdField, getIterator, getIterator, getKeyField, getLabelField, getMessageCount, getMessageField, getOrder, getPrefix, getSlotId, getSlotIdField, getType, getTypeField, getWhereClause, setCommentField, setCorrelationIdField, setDateField, setExpiryDateField, setHideMethod, setHideRegex, setIdField, setKeyField, setLabelField, setMessageField, setOrder, setPrefix
Methods inherited from class org.frankframework.jdbc.JdbcFacade
getAuthAlias, getConnection, getConnectionWithTimeout, getDataSourceFactory, getDatasourceInfo, getDatasourceName, getDbmsSupport, getDomain, getPassword, getUsername, isConnectionsArePooled, isTransacted, setAuthAlias, setConnectionsArePooled, setDataSourceFactory, setDatasourceName, setDbmsSupportFactory, setJmsRealm, setPassword, setTransacted, setUsername
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, setJndiAuthAlias, setJndiContextPrefix, setJndiProperties, setName, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixes, stop, toString
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.IMessageBrowser
browseMessage, containsCorrelationId, containsMessageId, deleteMessage, getContext, getHideMethod, getHideRegex, getIterator, getIterator, getMessageCount, setHideMethod, setHideRegex
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
Methods inherited from interface org.frankframework.core.ISender
sendMessageOrThrow, start, stop
Methods inherited from interface org.frankframework.core.ISenderWithParameters
consumesSessionVariable
Methods inherited from interface org.frankframework.core.ITransactionalStorage
getSlotId, getType, stop
Methods inherited from interface org.frankframework.core.IXAEnabled
isTransacted
-
Field Details
-
PARAM_MESSAGEID
- See Also:
-
-
Constructor Details
-
MessageStoreSender
public MessageStoreSender()
-
-
Method Details
-
configure
Description copied from class:JdbcTransactionalStorage
Creates a connection, checks if the table is existing and creates it when necessary- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceISender
- Specified by:
configure
in interfaceITransactionalStorage<String>
- Overrides:
configure
in classJdbcTransactionalStorage<String>
- Throws:
ConfigurationException
-
isSynchronous
public boolean isSynchronous()Description copied from interface:ISender
Whentrue
, the result of sendMessage is the reply of the request.- Specified by:
isSynchronous
in interfaceISender
-
addParameter
- Specified by:
addParameter
in interfaceIWithParameters
-
getParameterList
- Specified by:
getParameterList
in interfaceIWithParameters
-
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
-
setSessionKeys
Comma separated list of sessionKey's to be stored together with the message. Please note: correspondingMessageStoreListener
must 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:
setOnlyStoreWhenMessageIdUnique
in classJdbcTransactionalStorage<String>
- 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:
setSlotId
in interfaceITransactionalStorage<String>
- Overrides:
setSlotId
in classJdbcTransactionalStorage<String>
- Parameters:
string
- TheslotID
value for this MessageStoreSender.
-
getSessionKeys
-