public abstract class DefaultSqlEndpoint
extends org.apache.camel.impl.DefaultPollingEndpoint
Constructor and Description |
---|
DefaultSqlEndpoint() |
DefaultSqlEndpoint(String uri,
org.apache.camel.Component component,
org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
Modifier and Type | Method and Description |
---|---|
DataSource |
getDataSource() |
String |
getDataSourceRef() |
int |
getExpectedUpdateCount() |
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate() |
int |
getMaxMessagesPerPoll() |
String |
getOnConsume() |
String |
getOnConsumeBatchComplete() |
String |
getOnConsumeFailed() |
String |
getOutputClass() |
String |
getOutputHeader() |
SqlOutputType |
getOutputType() |
int |
getParametersCount() |
String |
getPlaceholder() |
SqlPrepareStatementStrategy |
getPrepareStatementStrategy() |
SqlProcessingStrategy |
getProcessingStrategy() |
char |
getSeparator() |
Map<String,Object> |
getTemplateOptions() |
boolean |
isAllowNamedParameters() |
boolean |
isAlwaysPopulateStatement() |
boolean |
isBatch() |
boolean |
isBreakBatchOnConsumeFail() |
boolean |
isNoop() |
boolean |
isRouteEmptyResultSet() |
boolean |
isSingleton() |
boolean |
isTransacted() |
boolean |
isUseIterator() |
boolean |
isUseMessageBodyForSql() |
boolean |
isUsePlaceholder() |
List<?> |
queryForList(ResultSet rs,
boolean allowMapToClass) |
Object |
queryForObject(ResultSet rs) |
ResultSetIterator |
queryForStreamList(Connection connection,
Statement statement,
ResultSet rs) |
void |
setAllowNamedParameters(boolean allowNamedParameters)
Whether to allow using named parameters in the queries.
|
void |
setAlwaysPopulateStatement(boolean alwaysPopulateStatement)
If enabled then the populateStatement method from org.apache.camel.component.sql.SqlPrepareStatementStrategy is always invoked,
also if there is no expected parameters to be prepared.
|
void |
setBatch(boolean batch)
Enables or disables batch mode
|
void |
setBreakBatchOnConsumeFail(boolean breakBatchOnConsumeFail)
Sets whether to break batch if onConsume failed.
|
void |
setDataSource(DataSource dataSource)
Sets the DataSource to use to communicate with the database.
|
void |
setDataSourceRef(String dataSourceRef)
Sets the reference to a DataSource to lookup from the registry, to use for communicating with the database.
|
void |
setExpectedUpdateCount(int expectedUpdateCount)
Sets an expected update count to validate when using onConsume.
|
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
void |
setMaxMessagesPerPoll(int maxMessagesPerPoll)
Sets the maximum number of messages to poll
|
void |
setNoop(boolean noop)
If set, will ignore the results of the SQL query and use the existing IN message as the OUT message for the continuation of processing
|
void |
setOnConsume(String onConsume)
After processing each row then this query can be executed, if the Exchange was processed successfully, for example to mark the row as processed.
|
void |
setOnConsumeBatchComplete(String onConsumeBatchComplete)
After processing the entire batch, this query can be executed to bulk update rows etc.
|
void |
setOnConsumeFailed(String onConsumeFailed)
After processing each row then this query can be executed, if the Exchange failed, for example to mark the row as failed.
|
void |
setOutputClass(String outputClass)
Specify the full package and class name to use as conversion when outputType=SelectOne.
|
void |
setOutputHeader(String outputHeader)
Store the query result in a header instead of the message body.
|
void |
setOutputType(SqlOutputType outputType)
Make the output of consumer or producer to SelectList as List of Map, or SelectOne as single Java object in the following way:
a) If the query has only single column, then that JDBC Column object is returned.
|
void |
setParametersCount(int parametersCount)
If set greater than zero, then Camel will use this count value of parameters to replace instead of querying via JDBC metadata API.
|
void |
setPlaceholder(String placeholder)
Specifies a character that will be replaced to ? in SQL query.
|
void |
setPrepareStatementStrategy(SqlPrepareStatementStrategy prepareStatementStrategy)
Allows to plugin to use a custom org.apache.camel.component.sql.SqlPrepareStatementStrategy to control preparation of the query and prepared statement.
|
void |
setProcessingStrategy(SqlProcessingStrategy processingStrategy)
Allows to plugin to use a custom org.apache.camel.component.sql.SqlProcessingStrategy to execute queries when the consumer has processed the rows/batch.
|
void |
setRouteEmptyResultSet(boolean routeEmptyResultSet)
Sets whether empty resultset should be allowed to be sent to the next hop.
|
void |
setSeparator(char separator)
The separator to use when parameter values is taken from message body (if the body is a String type), to be inserted at # placeholders.
|
void |
setTemplateOptions(Map<String,Object> templateOptions)
Configures the Spring JdbcTemplate with the key/values from the Map
|
void |
setTransacted(boolean transacted)
Enables or disables transaction.
|
void |
setUseIterator(boolean useIterator)
Sets how resultset should be delivered to route.
|
void |
setUseMessageBodyForSql(boolean useMessageBodyForSql)
Whether to use the message body as the SQL and then headers for parameters.
|
void |
setUsePlaceholder(boolean usePlaceholder)
Sets whether to use placeholder and replace all placeholder characters with ? sign in the SQL queries.
|
configurePollingConsumer, configureProperties, configureScheduledPollConsumerProperties, doStart, doStop, getBackoffErrorThreshold, getBackoffIdleThreshold, getBackoffMultiplier, getDelay, getInitialDelay, getPollStrategy, getRunLoggingLevel, getScheduledExecutorService, getScheduler, getSchedulerProperties, getTimeUnit, initConsumerProperties, isGreedy, isSendEmptyMessageWhenIdle, isStartScheduler, isUseFixedDelay, setBackoffErrorThreshold, setBackoffIdleThreshold, setBackoffMultiplier, setDelay, setGreedy, setInitialDelay, setPollStrategy, setRunLoggingLevel, setScheduledExecutorService, setScheduler, setScheduler, setSchedulerProperties, setSendEmptyMessageWhenIdle, setStartScheduler, setTimeUnit, setUseFixedDelay
configureConsumer, createEndpointConfiguration, createEndpointUri, createExchange, createExchange, createExchange, createPollingConsumer, equals, getCamelContext, getComponent, getConsumerProperties, getEndpointConfiguration, getEndpointKey, getEndpointUri, getExceptionHandler, getExchangePattern, getId, getPollingConsumerBlockTimeout, getPollingConsumerQueueSize, hashCode, isBridgeErrorHandler, isLenientProperties, isPollingConsumerBlockWhenFull, isSynchronous, setBridgeErrorHandler, setCamelContext, setConsumerProperties, setEndpointConfiguration, setEndpointUri, setEndpointUriIfNotSpecified, setExceptionHandler, setExchangePattern, setPollingConsumerBlockTimeout, setPollingConsumerBlockWhenFull, setPollingConsumerQueueSize, setProperties, setSynchronous, toString
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public DefaultSqlEndpoint()
public DefaultSqlEndpoint(String uri, org.apache.camel.Component component, org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public boolean isSingleton()
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public boolean isTransacted()
public void setTransacted(boolean transacted)
public boolean isBatch()
public void setBatch(boolean batch)
public int getMaxMessagesPerPoll()
public void setMaxMessagesPerPoll(int maxMessagesPerPoll)
public SqlProcessingStrategy getProcessingStrategy()
public void setProcessingStrategy(SqlProcessingStrategy processingStrategy)
public SqlPrepareStatementStrategy getPrepareStatementStrategy()
public void setPrepareStatementStrategy(SqlPrepareStatementStrategy prepareStatementStrategy)
public String getOnConsume()
public void setOnConsume(String onConsume)
public String getOnConsumeFailed()
public void setOnConsumeFailed(String onConsumeFailed)
public String getOnConsumeBatchComplete()
public void setOnConsumeBatchComplete(String onConsumeBatchComplete)
public boolean isAllowNamedParameters()
public void setAllowNamedParameters(boolean allowNamedParameters)
public boolean isAlwaysPopulateStatement()
public void setAlwaysPopulateStatement(boolean alwaysPopulateStatement)
public char getSeparator()
public void setSeparator(char separator)
public SqlOutputType getOutputType()
public void setOutputType(SqlOutputType outputType)
public String getOutputClass()
public void setOutputClass(String outputClass)
public int getParametersCount()
public void setParametersCount(int parametersCount)
public boolean isNoop()
public void setNoop(boolean noop)
public String getOutputHeader()
public void setOutputHeader(String outputHeader)
public boolean isUseMessageBodyForSql()
public void setUseMessageBodyForSql(boolean useMessageBodyForSql)
public String getDataSourceRef()
public void setDataSourceRef(String dataSourceRef)
public DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public boolean isUseIterator()
public void setUseIterator(boolean useIterator)
public boolean isRouteEmptyResultSet()
public void setRouteEmptyResultSet(boolean routeEmptyResultSet)
public int getExpectedUpdateCount()
public void setExpectedUpdateCount(int expectedUpdateCount)
public boolean isBreakBatchOnConsumeFail()
public void setBreakBatchOnConsumeFail(boolean breakBatchOnConsumeFail)
public String getPlaceholder()
public void setPlaceholder(String placeholder)
public boolean isUsePlaceholder()
public void setUsePlaceholder(boolean usePlaceholder)
public void setTemplateOptions(Map<String,Object> templateOptions)
public List<?> queryForList(ResultSet rs, boolean allowMapToClass) throws SQLException
SQLException
public Object queryForObject(ResultSet rs) throws SQLException
SQLException
public ResultSetIterator queryForStreamList(Connection connection, Statement statement, ResultSet rs) throws SQLException
SQLException
Apache Camel