Package org.frankframework.jdbc
Class SimpleJdbcListener
java.lang.Object
org.frankframework.jdbc.JdbcFacade
org.frankframework.jdbc.SimpleJdbcListener
- All Implemented Interfaces:
FrankElement,HasApplicationContext,HasName,HasPhysicalDestination,IConfigurable,IListener<String>,IPullingListener<String>,IScopeProvider,IXAEnabled,NameAware,ConfigurableLifecycle,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
Database Listener that returns a count of messages available, but does not perform any locking or
other management of processing messages in parallel.
- Author:
- Peter Leeuwenburgh
-
Field Summary
FieldsFields inherited from class org.frankframework.jdbc.JdbcFacade
logFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession) Called to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.voidcloseThread(Map<String, Object> threadContext) Finalizes a message receiving thread.voidConfigure this component.protected voidexecute(Connection conn, String query) protected voidexecute(Connection conn, String query, String parameter) protected ResultSetexecuteQuery(Connection conn, String query) extractMessage(RawMessageWrapper<String> rawMessage, Map<String, Object> context) Extracts data from message obtained fromIPullingListener.getRawMessage(Map)orIPushingListener.wrapRawMessage(Object, PipeLineSession).protected RawMessageWrapper<String> getRawMessage(Connection conn, Map<String, Object> threadContext) getRawMessage(Map<String, Object> threadContext) Retrieves messages from queue or other channel, but does no processing on it.booleanisTrace()Prepares a thread for receiving messages.voidsetSelectQuery(String string) count query that returns the number of available records. when there are available records the pipeline is activatedvoidsetTrace(boolean trace) voidstart()Prepares the listener for receiving messages.voidstop()Close all resources used for listening.Methods inherited from class org.frankframework.jdbc.JdbcFacade
getConnection, getConnectionWithTimeout, getDatasource, getDatasourceName, getDbmsSupport, getLogPrefix, getPassword, getPhysicalDestinationName, isConnectionsArePooled, isRunning, isTransacted, setAuthAlias, setConnectionsArePooled, setDatasourceName, setDbmsSupportFactory, setName, setPassword, setTransacted, setUsernameMethods 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.springframework.context.SmartLifecycle
stop
-
Field Details
-
KEYWORD_SELECT_COUNT
- See Also:
-
connection
-
-
Constructor Details
-
SimpleJdbcListener
public SimpleJdbcListener()
-
-
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 classJdbcFacade- 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<String>- Specified by:
startin interfaceorg.springframework.context.Lifecycle- Overrides:
startin classJdbcFacade
-
stop
public void stop()Description copied from interface:IListenerClose all resources used for listening. Called once each time the listener is stopped.- Specified by:
stopin interfaceIListener<String>- Specified by:
stopin interfaceorg.springframework.context.Lifecycle- Overrides:
stopin classJdbcFacade
-
openThread
Description copied from interface:IPullingListenerPrepares a thread for receiving messages. Called once for each thread that will listen for messages.- Specified by:
openThreadin interfaceIPullingListener<String>- Returns:
- the threadContext for this thread. The threadContext is a Map in which
thread-specific data can be stored. May not be
null, must be a mutable map type. - Throws:
ListenerException
-
closeThread
Description copied from interface:IPullingListenerFinalizes a message receiving thread. Called once for each thread that listens for messages, just beforeIListener.stop()is called.- Specified by:
closeThreadin interfaceIPullingListener<String>- Throws:
ListenerException
-
getRawMessage
public RawMessageWrapper<String> getRawMessage(@Nonnull Map<String, Object> threadContext) throws ListenerExceptionDescription copied from interface:IPullingListenerRetrieves messages from queue or other channel, but does no processing on it. Multiple objects may try to call this method at the same time, from different threads. Implementations of this method should therefore be thread-safe, orsynchronized.Any thread-specific properties should be stored in and retrieved from the threadContext.
- Specified by:
getRawMessagein interfaceIPullingListener<String>- Throws:
ListenerException
-
getRawMessage
protected RawMessageWrapper<String> getRawMessage(Connection conn, Map<String, Object> threadContext) throws ListenerException- Throws:
ListenerException
-
extractMessage
public Message extractMessage(@Nonnull RawMessageWrapper<String> rawMessage, @Nonnull Map<String, Object> context) Description copied from interface:IListenerExtracts 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:
extractMessagein interfaceIListener<String>- Parameters:
rawMessage- TheRawMessageWrapperfrom which to extract theMessage.context- Context to populate. Either aPipeLineSessionor aMapthreadContext depending on caller.- Returns:
- input
Messagefor adapter.
-
executeQuery
- Throws:
ListenerException
-
afterMessageProcessed
public void afterMessageProcessed(PipeLineResult processResult, RawMessageWrapper<String> rawMessage, PipeLineSession pipeLineSession) Description copied from interface:IListenerCalled to perform actions (like committing or sending a reply) after a message has been processed by the Pipeline.- Specified by:
afterMessageProcessedin interfaceIListener<String>
-
execute
- Throws:
ListenerException
-
execute
- Throws:
ListenerException
-
setSelectQuery
count query that returns the number of available records. when there are available records the pipeline is activated -
getSelectQuery
-
isTrace
public boolean isTrace() -
setTrace
public void setTrace(boolean trace)
-