public class JdbcConnector extends AbstractConnector implements org.mule.common.Testable
Modifier and Type | Field and Description |
---|---|
protected DataSource |
dataSource |
static long |
DEFAULT_POLLING_FREQUENCY |
protected Map<OutboundEndpoint,MessageDispatcher> |
endpointDispatchers |
static String |
JDBC |
protected long |
pollingFrequency |
static String |
PROPERTY_POLLING_FREQUENCY |
protected Map |
queries |
protected org.apache.commons.dbutils.QueryRunner |
queryRunner |
protected org.apache.commons.dbutils.ResultSetHandler |
resultSetHandler |
protected boolean |
transactionPerMessage
Should each DB record be received in a separate transaction or should there be a single transaction for
the entire ResultSet?
|
static String |
USE_DISPATCHER_POOL_SYSTEM_PROPERTY |
createMultipleTransactedReceivers, DEFAULT_NUM_CONCURRENT_TX_RECEIVERS, dispatcherFactory, dispatcherPoolFactory, dispatchers, initialStateStopped, lifecycleManager, logger, muleContext, muleMessageFactory, name, numberOfConcurrentTransactedReceivers, receivers, requesterFactory, requesters, serviceDescriptor, serviceOverrides, sessionHandler, startOnConnect
INT_VALUE_NOT_SET
PHASE_NAME
Constructor and Description |
---|
JdbcConnector(MuleContext context) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyDispatcherLifecycle(MessageDispatcher dispatcher) |
protected MessageDispatcher |
borrowDispatcher(OutboundEndpoint endpoint) |
MessageProcessor |
createDispatcherMessageProcessor(OutboundEndpoint endpoint) |
protected <T> T |
createOperationResource(ImmutableEndpoint endpoint) |
MessageReceiver |
createReceiver(FlowConstruct flowConstruct,
InboundEndpoint endpoint)
Create a Message receiver for this connector
|
protected void |
doConnect()
Template method where any connections should be made for the connector
|
protected void |
doDisconnect()
Template method where any connected resources used by the connector should be
disconnected
|
protected void |
doDispose()
Template method to perform any work when destroying the connectoe
|
protected void |
doInitialise() |
protected void |
doStart()
Template method to perform any work when starting the connectoe
|
protected void |
doStop()
Template method to perform any work when stopping the connectoe
|
Connection |
getConnection() |
DataSource |
getDataSource() |
protected String |
getNameFromParam(String param) |
protected <T> T |
getOperationResourceFactory() |
Object[] |
getParams(ImmutableEndpoint endpoint,
List paramNames,
MuleMessage message,
String query) |
protected Object |
getParamValue(ImmutableEndpoint endpoint,
MuleMessage message,
String param) |
long |
getPollingFrequency() |
String |
getProtocol() |
Map |
getQueries() |
String |
getQuery(ImmutableEndpoint endpoint,
String stmt) |
org.apache.commons.dbutils.QueryRunner |
getQueryRunner() |
org.apache.commons.dbutils.QueryRunner |
getQueryRunnerFor(ImmutableEndpoint endpoint) |
int |
getQueryTimeout() |
String[] |
getReadAndAckStatements(ImmutableEndpoint endpoint) |
org.apache.commons.dbutils.ResultSetHandler |
getResultSetHandler() |
SqlStatementStrategyFactory |
getSqlStatementStrategyFactory() |
String |
getStatement(ImmutableEndpoint endpoint) |
boolean |
isTransactionPerMessage() |
String |
parseStatement(String stmt,
List<String> params)
Parse the given statement filling the parameter list and return the ready to use statement.
|
protected void |
returnDispatcher(OutboundEndpoint endpoint,
MessageDispatcher dispatcher) |
void |
setDataSource(DataSource dataSource) |
void |
setPollingFrequency(long pollingFrequency) |
void |
setQueries(Map queries) |
void |
setQueryRunner(org.apache.commons.dbutils.QueryRunner queryRunner) |
void |
setQueryTimeout(int queryTimeout) |
void |
setResultSetHandler(org.apache.commons.dbutils.ResultSetHandler resultSetHandler) |
void |
setSqlStatementStrategyFactory(SqlStatementStrategyFactory sqlStatementStrategyFactory) |
void |
setTransactionPerMessage(boolean transactionPerMessage) |
org.mule.common.TestResult |
test() |
RetryContext |
validateConnection(RetryContext retryContext)
Verify that we are able to connect to the DataSource (needed for retry policies)
|
clearDispatchers, clearRequesters, configureDispatcherPool, connect, createDefaultRedeliveryPolicy, createMuleMessageFactory, createScheduler, destroyReceiver, disconnect, dispose, disposeReceivers, disposeWorkManagers, doUnregisterListener, fireNotification, getCanonicalURI, getConnectEventId, getConnectionDescription, getDefaultExchangePattern, getDefaultInboundTransformers, getDefaultOutboundTransformers, getDefaultResponseTransformers, getDispatcherFactory, getDispatcherPoolFactory, getDispatcherThreadingProfile, getDispatcherWorkManager, getInboundExchangePatterns, getLifecycleState, getMaxDispatchersActive, getMaxRequestersActive, getMaxTotalDispatchers, getMuleContext, getMuleMessageFactory, getName, getNumberOfConcurrentTransactedReceivers, getOutboundExchangePatterns, getOutputStream, getReceiver, getReceiverKey, getReceivers, getReceivers, getReceiverThreadingProfile, getReceiverWorkManager, getReplyToHandler, getRequesterFactory, getRequesterThreadingProfile, getRequesterWorkManager, getRetryPolicyTemplate, getScheduler, getServiceDescriptor, getServiceOverrides, getSessionHandler, getSupportedProtocols, getTransactionalResource, handleWorkException, initFromServiceDescriptor, initialise, initialiseFromUrl, initWorkManagers, isConnected, isConnecting, isCreateMultipleTransactedReceivers, isDisposed, isEnableMessageEvents, isInitialised, isInitialStateStopped, isResponseEnabled, isStarted, isStarting, isStopped, isStopping, isValidateConnections, lookupReceiver, registerListener, registerSupportedMetaProtocol, registerSupportedProtocol, registerSupportedProtocolWithoutPrefix, request, request, setConnected, setConnecting, setCreateMultipleTransactedReceivers, setDispatcherFactory, setDispatcherPoolFactory, setDispatcherPoolMaxWait, setDispatcherPoolWhenExhaustedAction, setDispatcherThreadingProfile, setDynamicNotification, setInitialStateStopped, setMaxDispatchersActive, setMaxRequestersActive, setName, setNumberOfConcurrentTransactedReceivers, setReceiverThreadingProfile, setRequesterFactory, setRequesterPoolMaxWait, setRequesterPoolWhenExhaustedAction, setRequesterThreadingProfile, setRetryPolicyTemplate, setServiceOverrides, setSessionHandler, setSupportedProtocols, setupDispatchReturn, setupRequestReturn, setValidateConnections, shutdownScheduler, start, startAfterConnect, stop, supportsProtocol, toString, unregisterListener, unregisterSupportedProtocol, updateCachedNotificationHandler, workAccepted, workCompleted, workRejected, workStarted
public static final String JDBC
public static final String PROPERTY_POLLING_FREQUENCY
public static final long DEFAULT_POLLING_FREQUENCY
public static final String USE_DISPATCHER_POOL_SYSTEM_PROPERTY
protected long pollingFrequency
protected Map queries
protected DataSource dataSource
protected org.apache.commons.dbutils.ResultSetHandler resultSetHandler
protected org.apache.commons.dbutils.QueryRunner queryRunner
protected boolean transactionPerMessage
protected Map<OutboundEndpoint,MessageDispatcher> endpointDispatchers
public JdbcConnector(MuleContext context)
protected void doInitialise() throws InitialisationException
doInitialise
in class AbstractConnector
InitialisationException
public MessageReceiver createReceiver(FlowConstruct flowConstruct, InboundEndpoint endpoint) throws Exception
AbstractConnector
createReceiver
in class AbstractConnector
flowConstruct
- the service that will receive events from this receiver, the
listenerendpoint
- the endpoint that defies this inbound communicationTransportServiceDescriptor
initialised using the service and endpoint.Exception
- if there is a problem creating the receiver. This exception
really depends on the underlying transport, thus any exception
could be thrownpublic String[] getReadAndAckStatements(ImmutableEndpoint endpoint)
public String getQuery(ImmutableEndpoint endpoint, String stmt)
public Connection getConnection() throws Exception
Exception
public boolean isTransactionPerMessage()
public void setTransactionPerMessage(boolean transactionPerMessage)
public String parseStatement(String stmt, List<String> params)
stmt
- params
- public Object[] getParams(ImmutableEndpoint endpoint, List paramNames, MuleMessage message, String query) throws Exception
Exception
protected Object getParamValue(ImmutableEndpoint endpoint, MuleMessage message, String param)
protected void doDispose()
AbstractConnector
doDispose
in class AbstractConnector
protected void doConnect() throws Exception
AbstractConnector
doConnect
in class AbstractConnector
Exception
public RetryContext validateConnection(RetryContext retryContext)
validateConnection
in interface Connectable
validateConnection
in class AbstractConnector
retryContext
- RetryContext.isOk()
,
RetryContext.getLastFailure()
protected void doDisconnect() throws Exception
AbstractConnector
doDisconnect
in class AbstractConnector
Exception
protected void doStart() throws MuleException
AbstractConnector
doStart
in class AbstractConnector
MuleException
- if the method failsprotected void doStop() throws MuleException
AbstractConnector
doStop
in class AbstractConnector
MuleException
- if the method failspublic String getProtocol()
getProtocol
in interface Connector
public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public org.apache.commons.dbutils.ResultSetHandler getResultSetHandler()
public void setResultSetHandler(org.apache.commons.dbutils.ResultSetHandler resultSetHandler)
public org.apache.commons.dbutils.QueryRunner getQueryRunnerFor(ImmutableEndpoint endpoint)
public org.apache.commons.dbutils.QueryRunner getQueryRunner()
public void setQueryRunner(org.apache.commons.dbutils.QueryRunner queryRunner)
public long getPollingFrequency()
public void setPollingFrequency(long pollingFrequency)
pollingFrequency
- The pollingFrequency to set.public Map getQueries()
public void setQueries(Map queries)
queries
- The queries to set.public SqlStatementStrategyFactory getSqlStatementStrategyFactory()
public void setSqlStatementStrategyFactory(SqlStatementStrategyFactory sqlStatementStrategyFactory)
public String getStatement(ImmutableEndpoint endpoint)
public int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
protected <T> T getOperationResourceFactory()
getOperationResourceFactory
in class AbstractConnector
protected <T> T createOperationResource(ImmutableEndpoint endpoint) throws MuleException
createOperationResource
in class AbstractConnector
MuleException
public org.mule.common.TestResult test()
test
in interface org.mule.common.Testable
public MessageProcessor createDispatcherMessageProcessor(OutboundEndpoint endpoint) throws MuleException
createDispatcherMessageProcessor
in class AbstractConnector
MuleException
protected MessageDispatcher borrowDispatcher(OutboundEndpoint endpoint) throws MuleException
borrowDispatcher
in class AbstractConnector
MuleException
protected void returnDispatcher(OutboundEndpoint endpoint, MessageDispatcher dispatcher)
returnDispatcher
in class AbstractConnector
protected void applyDispatcherLifecycle(MessageDispatcher dispatcher) throws MuleException
MuleException
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.