public class SimpleJdbcListener extends JdbcFacade implements IPullingListener<String>
HasStatistics.Action
Modifier and Type | Field and Description |
---|---|
protected Connection |
connection |
protected static String |
KEYWORD_SELECT_COUNT |
Constructor and Description |
---|
SimpleJdbcListener() |
Modifier and Type | Method and Description |
---|---|
void |
afterMessageProcessed(PipeLineResult processResult,
Object rawMessage,
Map<String,Object> context)
Called to perform actions (like committing or sending a reply) after a message has been processed by the
Pipeline.
|
void |
close()
Close all resources used for listening.
|
void |
closeThread(Map<String,Object> threadContext)
Finalizes a message receiving thread.
|
void |
configure()
configure() is called once at startup of the framework in the configure() method
of the owner of this listener. |
protected void |
execute(Connection conn,
String query) |
protected void |
execute(Connection conn,
String query,
String parameter) |
protected ResultSet |
executeQuery(Connection conn,
String query) |
Message |
extractMessage(String rawMessage,
Map<String,Object> context)
Extracts string from message obtained from
IPullingListener.getRawMessage(Map) . |
String |
getIdFromRawMessage(String rawMessage,
Map<String,Object> context)
Extracts ID-string from message obtained from
IPullingListener.getRawMessage(Map) . |
protected String |
getRawMessage(Connection conn,
Map<String,Object> threadContext) |
String |
getRawMessage(Map<String,Object> threadContext)
Retrieves messages from queue or other channel, but does no processing on it.
|
String |
getSelectQuery() |
boolean |
isTrace() |
void |
open()
Prepares the listener for receiving messages.
|
Map<String,Object> |
openThread()
Prepares a thread for receiving messages.
|
void |
setSelectQuery(String string)
count query that returns the number of available records.
|
void |
setTrace(boolean trace) |
getAuthAlias, getConnection, getConnectionWithTimeout, getDatasource, getDatasourceInfo, getDatasourceName, getDbmsSupport, getLogPrefix, getPassword, getPhysicalDestinationName, getUsername, isConnectionsArePooled, isTransacted, iterateOverStatistics, setAuthAlias, setConnectionsArePooled, setDatasourceName, setDbmsSupportFactory, setJmsRealm, setPassword, setTransacted, setUsername
getContext, getJndiEnv, setAuthentication, setCredentials, setInitialContextFactoryName, setJndiAuthAlias, setJndiContextPrefix, setJndiProperties, setName, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixes, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getDomain
protected static final String KEYWORD_SELECT_COUNT
protected Connection connection
public void configure() throws ConfigurationException
IListener
configure()
is called once at startup of the framework in the configure()
method
of the owner of this listener.
Purpose of this method is to reduce creating connections to databases etc. in the IPullingListener.getRawMessage(Map)
method.
As much as possible class-instantiating should take place in the
configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface IListener<String>
configure
in class JdbcFacade
ConfigurationException
public void open() throws ListenerException
IListener
open()
is called once each time the listener is started.open
in interface IListener<String>
ListenerException
public void close()
IListener
public Map<String,Object> openThread() throws ListenerException
IPullingListener
openThread
in interface IPullingListener<String>
ListenerException
public void closeThread(Map<String,Object> threadContext) throws ListenerException
IPullingListener
IListener.close()
is called.closeThread
in interface IPullingListener<String>
ListenerException
public String getRawMessage(Map<String,Object> threadContext) throws ListenerException
IPullingListener
synchronized
.
Any thread-specific properties should be stored in and retrieved from the threadContext.
getRawMessage
in interface IPullingListener<String>
ListenerException
protected String getRawMessage(Connection conn, Map<String,Object> threadContext) throws ListenerException
ListenerException
public String getIdFromRawMessage(String rawMessage, Map<String,Object> context) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the context.
getIdFromRawMessage
in interface IListener<String>
ListenerException
public Message extractMessage(String rawMessage, Map<String,Object> context) throws ListenerException
IListener
IPullingListener.getRawMessage(Map)
. May also extract
other parameters from the message and put those in the threadContext.extractMessage
in interface IListener<String>
ListenerException
protected ResultSet executeQuery(Connection conn, String query) throws ListenerException
ListenerException
public void afterMessageProcessed(PipeLineResult processResult, Object rawMessage, Map<String,Object> context) throws ListenerException
IListener
afterMessageProcessed
in interface IListener<String>
ListenerException
protected void execute(Connection conn, String query) throws ListenerException
ListenerException
protected void execute(Connection conn, String query, String parameter) throws ListenerException
ListenerException
public void setSelectQuery(String string)
public String getSelectQuery()
public boolean isTrace()
public void setTrace(boolean trace)
Copyright © 2023 Frank!Framework. All rights reserved.