Class JdbcTableListener
java.lang.Object
org.frankframework.jdbc.JdbcFacade
org.frankframework.jdbc.AbstractJdbcListener
org.frankframework.jdbc.JdbcListener
org.frankframework.jdbc.JdbcTableListener
- All Implemented Interfaces:
FrankElement, HasApplicationContext, HasName, HasPhysicalDestination, IConfigurable, IHasProcessState<Serializable>, IListener<Serializable>, IPeekableListener<Serializable>, IProvidesMessageBrowsers<Serializable>, IPullingListener<Serializable>, IRedeliveringListener<Serializable>, IScopeProvider, NameAware, TransactionAware, ConfigurableLifecycle, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
- Direct Known Subclasses:
MessageStoreListener
public class JdbcTableListener
extends JdbcListener
implements IProvidesMessageBrowsers<Serializable>
Database Listener that operates on a table having at least a key and a status field.
- Since:
- 4.7
-
Field Summary
Fields inherited from class AbstractJdbcListener
ADDITIONAL_QUERY_FIELDS_KEY, additionalFields, additionalFieldsList, correlationIdField, keyField, messageField, messageIdField, peekQuery, peekUntransacted, preparedPeekQuery, preparedSelectQuery, selectQuery, traceFields inherited from class JdbcFacade
logFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable RawMessageWrapper<Serializable> changeProcessState(Connection connection, RawMessageWrapper<Serializable> rawMessage, ProcessState toState, String reason) voidConfigure this component.protected StringcreateUpdateStatusQuery(String fieldValue, String additionalSetClause) Get a map with all configured column names.@Nullable IMessageBrowser<Serializable> getMessageBrowser(ProcessState state) returns abrowserof 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).@NonNull StringReturns the name and location of the database that this objects operates on.getStatusValue(ProcessState state) getStorageType(ProcessState state) voidsetCommentField(String commentField) (optional) Field used to store the reason of the last change of thestatusFieldvoidsetMaxCommentLength(int maxCommentLength) (optional) Maximum length of strings to be stored in commentField, or -1 for unlimitedvoidsetOrderField(String string) (optional) Comma separated list of fields determining the order in which messages are processedvoidsetSelectCondition(String string) Additional condition for a row to belong to this TableListener.voidsetStatusField(String fieldname) Field containing the status of the message.voidsetStatusValueAvailable(String string) (optional) Value ofstatusFieldindicating row is available to be processed.voidsetStatusValueError(String string) Value ofstatusFieldindicating the processing of the row resulted in an errorvoidsetStatusValueHold(String string) Value ofstatusFieldindicating message is on Hold, temporarilyvoidsetStatusValueInProcess(String string) Value ofstatusFieldindicating is being processed.voidsetStatusValueProcessed(String string) Value of status field indicating row is processed OKvoidsetTableAlias(String string) Alias of the table, that can be used in selectConditionvoidsetTableName(String string) Name of the table to be usedvoidsetTimestampField(String fieldname) (optional) Field used to store the date and time of the last change of thestatusFieldvoidstart()Prepares the listener for receiving messages.protected voidverifyFieldNotInQuery(String fieldName, String query) Methods inherited from class JdbcListener
afterMessageProcessed, changeProcessState, getKeyFromRawMessage, getRawMessage, getRawMessage, getUpdateStatusQuery, knownProcessStates, messageWillBeRedeliveredOnExitStateError, setMessageFieldType, setUpdateStatusQuery, targetProcessStatesMethods inherited from class AbstractJdbcListener
addAdditionalValuesToMessageWrapper, closeThread, execute, extractMessage, extractRawMessage, getColumnValueOrDefault, getMessageKeyOrNull, hasRawMessageAvailable, openThread, setAdditionalFields, setCorrelationIdField, setKeyField, setMessageField, setMessageIdField, setPeekQuery, setPeekUntransacted, setSelectQueryMethods inherited from class JdbcFacade
convertQuery, getConnection, getConnectionWithTimeout, getDatasource, getDatasourceName, getDbmsSupport, getLogPrefix, getPassword, isRunning, setAuthAlias, setBlobCharset, setBlobsCompressed, setBlobSmartGet, setDatasourceName, setDbmsSupportFactory, setName, setPassword, setSqlDialect, setUsername, stop, withConnection, withConnectionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContextMethods inherited from interface ConfigurableLifecycle
getPhase, isAutoStartup, isConfiguredMethods inherited from interface FrankElement
addConfigWarningMethods inherited from interface HasApplicationContext
getApplicationContext, getConfigurationClassLoaderMethods inherited from interface IHasProcessState
changeProcessState, knownProcessStates, targetProcessStatesMethods inherited from interface IListener
extractMessage, stopMethods inherited from interface IPeekableListener
hasRawMessageAvailable, isPeekUntransacted, setPeekUntransactedMethods inherited from interface IPullingListener
closeThread, openThreadMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable, stop
-
Constructor Details
-
JdbcTableListener
public JdbcTableListener()
-
-
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 classJdbcListener- Throws:
ConfigurationException- in case it was not able to configure the component.
-
start
public void start()Description copied from interface:IListenerPrepares the listener for receiving messages.start()is called once each time the listener is started.- Specified by:
startin interfaceConfigurableLifecycle- Specified by:
startin interfaceIListener<Serializable>- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Overrides:
startin classJdbcFacade
-
getConfiguredColumnNames
Get a map with all configured column names. This is used in validation of the configuration. The key is the functional name of the field and the value the column name in the database. Subclasses may potentially override this method to add more fields that the subclass defines. The returned map must be modifiable, and all column names must be in all-caps. -
verifyFieldNotInQuery
-
createUpdateStatusQuery
-
changeProcessState
protected @Nullable RawMessageWrapper<Serializable> changeProcessState(Connection connection, RawMessageWrapper<Serializable> rawMessage, ProcessState toState, String reason) throws ListenerException - Overrides:
changeProcessStatein classJdbcListener- Throws:
ListenerException
-
getMessageBrowser
Description copied from interface:IProvidesMessageBrowsersreturns abrowserof 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:
getMessageBrowserin interfaceIProvidesMessageBrowsers<Serializable>
-
getStatusValue
-
getStorageType
-
getPhysicalDestinationName
Description copied from class:JdbcFacadeReturns the name and location of the database that this objects operates on. If no previous connection was made or it cannot determine the destination it returns 'unknown'- Specified by:
getPhysicalDestinationNamein interfaceHasPhysicalDestination- Overrides:
getPhysicalDestinationNamein classJdbcFacade- See Also:
-
setTableName
Name of the table to be used -
setTableAlias
Alias of the table, that can be used in selectCondition- Default value
- t
-
setStatusField
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. -
setOrderField
(optional) Comma separated list of fields determining the order in which messages are processed -
setTimestampField
(optional) Field used to store the date and time of the last change of thestatusField -
setCommentField
(optional) Field used to store the reason of the last change of thestatusField -
setMaxCommentLength
public void setMaxCommentLength(int maxCommentLength) (optional) Maximum length of strings to be stored in commentField, or -1 for unlimited- Default value
- 1000
-
setStatusValueAvailable
(optional) Value ofstatusFieldindicating row is available to be processed. If not specified, any row not having any of the other status values is considered available. -
setStatusValueError
Value ofstatusFieldindicating the processing of the row resulted in an error -
setStatusValueProcessed
Value of status field indicating row is processed OK -
setStatusValueInProcess
Value ofstatusFieldindicating is being processed. Can be left emtpy if database hasSKIP LOCKEDfunctionality and thetransactionAttributeof theReceivercan be (and is) set toRequiredorRequiresNew. -
setStatusValueHold
Value ofstatusFieldindicating message is on Hold, temporarily -
setSelectCondition
Additional condition for a row to belong to this TableListener. Impacts all process states
-