Package org.frankframework.jdbc
Class MessageStoreListener<M>
java.lang.Object
org.frankframework.jndi.JndiBase
org.frankframework.jdbc.JdbcFacade
org.frankframework.jdbc.JdbcListener<M>
org.frankframework.jdbc.JdbcTableListener<M>
org.frankframework.jdbc.MessageStoreListener<M>
- All Implemented Interfaces:
HasPhysicalDestination
,IConfigurable
,IConfigurationAware
,IHasProcessState<M>
,IListener<M>
,INamedObject
,IPeekableListener<M>
,IProvidesMessageBrowsers<M>
,IPullingListener<M>
,IScopeProvider
,IXAEnabled
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
Read messages from the IBISSTORE database table previously stored by a
See /IAF_util/IAF_DatabaseChangelog.xml for the structure of table IBISSTORE.
MessageStoreSender
.
Example configuration:
<Receiver
name="03 MessageStoreReceiver"
numThreads="4"
transactionAttribute="Required"
pollInterval="1">
<MessageStoreListener
name="03 MessageStoreListener"
slotId="${instance.name}/TestMessageStore"
statusValueInProcess="I" />
</Receiver>
If you have a MessageStoreListener
, failed messages are automatically kept in database
table IBISSTORE. Messages are also kept after successful processing. The state of a message
is distinguished by the TYPE
field, as follows:
-
M
: The message is new. From a functional perspective, it is in the message store. -
E
: There was an error processing the message. From a functional perspective, it is in the error store. -
A
: The message was successfully processed. From a functional perspective, it is in the message log.
MessageStoreListener
acts as a message log and as an error store.
If you have it, you do not need to add
a JdbcErrorStorage
or JdbcMessageLog
within the same receiver.
See /IAF_util/IAF_DatabaseChangelog.xml for the structure of table IBISSTORE.
- Author:
- Jaco de Groot
-
Nested Class Summary
Nested classes/interfaces inherited from class org.frankframework.jdbc.JdbcListener
JdbcListener.MessageFieldType
-
Field Summary
Fields inherited from class org.frankframework.jdbc.JdbcListener
connection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected IMessageBrowser<M>
augmentMessageBrowser
(IMessageBrowser<M> browser) void
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener.extractMessage
(RawMessageWrapper<M> rawMessage, Map<String, Object> context) Extracts data from message obtained fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
.void
getMessageBrowser
(ProcessState state) returns abrowser
of messages that are in ProcessState 'state', and are stored in a storage managed by the listener itself (as opposed to a storage configured as a messageLog or errorStorage in the configuration).boolean
void
setBlobSmartGet
(boolean b) Controls automatically whether blobdata is stored compressed and/or serialized in the database.void
setCommentField
(String commentField) (optional) Field used to store the reason of the last change of thestatusField
void
setCorrelationIdField
(String fieldname) Field containing thecorrelationId
.void
setKeyField
(String fieldname) Primary key field of the table, used to identify and differentiate messages.void
setMessageField
(String fieldname) Field containing the message datavoid
setMessageFieldType
(JdbcListener.MessageFieldType fieldtype) Type of the field containing the message datavoid
setMessageIdField
(String fieldname) Field containing themessageId
.void
setMoveToMessageLog
(boolean moveToMessageLog) Move to messageLog after processing, as the message is already stored in the ibisstore only some fields need to be updated.void
setSessionKeys
(String sessionKeys) Comma separated list of sessionKey's to be read together with the message.void
Identifier for this servicevoid
setStatusField
(String fieldname) Field containing the status of the message.void
setStatusValueAvailable
(String string) Value of statusField indicating row is available to be processed.void
setStatusValueError
(String string) Value ofstatusField
indicating the processing of the row resulted in an errorvoid
setStatusValueHold
(String string) Value of status field indicating message is on Hold, temporarily.void
setStatusValueInProcess
(String string) Value of status field indicating is being processed.void
setStatusValueProcessed
(String string) Value of status field indicating row is processed OKvoid
setTableName
(String string) Name of the table to be usedvoid
setTimestampField
(String fieldname) (optional) Field used to store the date and time of the last change of thestatusField
Methods inherited from class org.frankframework.jdbc.JdbcTableListener
changeProcessState, createUpdateStatusQuery, getCommentField, getMaxCommentLength, getOrderField, getPhysicalDestinationName, getStatusField, getStatusValue, getStorageType, getTableAlias, getTableName, getTimestampField, setMaxCommentLength, setOrderField, setSelectCondition, setTableAlias, verifyFieldNotInQuery
Methods inherited from class org.frankframework.jdbc.JdbcListener
afterMessageProcessed, changeProcessState, closeThread, convertQuery, execute, extractRawMessage, getBlobCharset, getCorrelationIdField, getKeyField, getKeyFromRawMessage, getMessageField, getMessageFieldType, getMessageIdField, getPeekQuery, getRawMessage, getRawMessage, getSelectQuery, getSqlDialect, getUpdateStatusQuery, hasRawMessageAvailable, hasRawMessageAvailable, isBlobsCompressed, isBlobSmartGet, isPeekUntransacted, isTrace, knownProcessStates, openThread, setBlobCharset, setBlobsCompressed, setPeekQuery, setPeekUntransacted, setSelectQuery, setSqlDialect, setTrace, setUpdateStatusQuery, start, stop, targetProcessStates
Methods inherited from class org.frankframework.jdbc.JdbcFacade
getAuthAlias, getConnection, getConnectionWithTimeout, getDatasource, getDataSourceFactory, getDatasourceInfo, getDatasourceName, getDbmsSupport, getDomain, getLogPrefix, 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, 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.IHasProcessState
changeProcessState, knownProcessStates, targetProcessStates
Methods inherited from interface org.frankframework.core.INamedObject
getName, setName
Methods inherited from interface org.frankframework.core.IScopeProvider
getConfigurationClassLoader
-
Constructor Details
-
MessageStoreListener
public MessageStoreListener()
-
-
Method Details
-
configure
Description copied from interface:IListener
configure()
is called once at startup of the framework in theconfigure()
method of the owner of this listener. Purpose of this method is to reduce creating connections to databases etc. in theIPullingListener.getRawMessage(Map)
method. As much as possible class-instantiating should take place in theconfigure()
orIListener.start()
method, to improve performance.- Specified by:
configure
in interfaceIConfigurable
- Specified by:
configure
in interfaceIListener<M>
- Overrides:
configure
in classJdbcTableListener<M>
- Throws:
ConfigurationException
-
extractSessionKeyList
public void extractSessionKeyList() -
extractMessage
public Message extractMessage(@Nonnull RawMessageWrapper<M> rawMessage, @Nonnull Map<String, Object> context) throws ListenerExceptionDescription copied from interface:IListener
Extracts data from message obtained fromIPullingListener.getRawMessage(Map)
orIPushingListener.wrapRawMessage(Object, PipeLineSession)
. May also extract other parameters from the message and put those into the context.- Specified by:
extractMessage
in interfaceIListener<M>
- Overrides:
extractMessage
in classJdbcListener<M>
- Parameters:
rawMessage
- TheRawMessageWrapper
from which to extract theMessage
.context
- Context to populate. Either aPipeLineSession
or aMap
threadContext depending on caller.- Returns:
- input
Message
for adapter. - Throws:
ListenerException
-
augmentMessageBrowser
-
getMessageBrowser
Description copied from interface:IProvidesMessageBrowsers
returns abrowser
of messages that are in ProcessState 'state', and are stored in a storage managed by the listener itself (as opposed to a storage configured as a messageLog or errorStorage in the configuration).- Specified by:
getMessageBrowser
in interfaceIProvidesMessageBrowsers<M>
- Overrides:
getMessageBrowser
in classJdbcTableListener<M>
-
getSelectCondition
- Overrides:
getSelectCondition
in classJdbcTableListener<M>
-
setSlotId
Identifier for this service -
setSessionKeys
Comma separated list of sessionKey's to be read together with the message. Please note: correspondingMessageStoreSender
must have the same value for this attribute -
setTableName
Description copied from class:JdbcTableListener
Name of the table to be used- Overrides:
setTableName
in classJdbcTableListener<M>
-
setKeyField
Description copied from class:JdbcListener
Primary key field of the table, used to identify and differentiate messages. NB: there should be an index on this field!- Overrides:
setKeyField
in classJdbcListener<M>
-
setMessageField
Description copied from class:JdbcListener
Field containing the message data- Overrides:
setMessageField
in classJdbcListener<M>
-
setMessageIdField
Description copied from class:JdbcListener
Field containing themessageId
. NB: If this column is not set the default (primary key)keyField
will be used as messageId!- Overrides:
setMessageIdField
in classJdbcListener<M>
-
setCorrelationIdField
Description copied from class:JdbcListener
Field containing thecorrelationId
. NB: If this column is not set, themessageId
andcorrelationId
will be the same!- Overrides:
setCorrelationIdField
in classJdbcListener<M>
-
setMessageFieldType
Description copied from class:JdbcListener
Type of the field containing the message data- Overrides:
setMessageFieldType
in classJdbcListener<M>
-
setBlobSmartGet
Description copied from class:JdbcListener
Controls automatically whether blobdata is stored compressed and/or serialized in the database. N.B. When set true, then the BLOB will be converted into a string- Overrides:
setBlobSmartGet
in classJdbcListener<M>
-
setStatusField
Description copied from class:JdbcTableListener
Field containing the status of the message. NB: For optimal performance, an index should exist that starts with this field, followed by all fields that are used with a fixed value in the select condition, and end with theorderField
.- Overrides:
setStatusField
in classJdbcTableListener<M>
-
setTimestampField
Description copied from class:JdbcTableListener
(optional) Field used to store the date and time of the last change of thestatusField
- Overrides:
setTimestampField
in classJdbcTableListener<M>
-
setCommentField
Description copied from class:JdbcTableListener
(optional) Field used to store the reason of the last change of thestatusField
- Overrides:
setCommentField
in classJdbcTableListener<M>
-
setStatusValueAvailable
Value of statusField indicating row is available to be processed. If set empty, any row not having any of the other status values is considered available.- Overrides:
setStatusValueAvailable
in classJdbcTableListener<M>
- Default value
M
-
setStatusValueInProcess
Value of status field indicating is being processed. Set toI
if database has no SKIP LOCKED functionality, the Receiver cannot be set toRequired
orRequiresNew
, or to support programmatic retry.- Overrides:
setStatusValueInProcess
in classJdbcTableListener<M>
-
setStatusValueError
Description copied from class:JdbcTableListener
Value ofstatusField
indicating the processing of the row resulted in an error- Overrides:
setStatusValueError
in classJdbcTableListener<M>
-
setStatusValueProcessed
Description copied from class:JdbcTableListener
Value of status field indicating row is processed OK- Overrides:
setStatusValueProcessed
in classJdbcTableListener<M>
-
setStatusValueHold
Value of status field indicating message is on Hold, temporarily. If required, suggested value isH
.- Overrides:
setStatusValueHold
in classJdbcTableListener<M>
-
setMoveToMessageLog
public void setMoveToMessageLog(boolean moveToMessageLog) Move to messageLog after processing, as the message is already stored in the ibisstore only some fields need to be updated. When setfalse
, messages are deleted after being processed- Default value
true
-
getSlotId
-
getSessionKeys
-
isMoveToMessageLog
public boolean isMoveToMessageLog()
-