camel-sql-kafka-connector sink configuration

Connector Description: Perform SQL queries using Spring JDBC.

When using camel-sql-kafka-connector as sink make sure to use the following Maven dependency to have support for the connector:

<dependency>
  <groupId>org.apache.camel.kafkaconnector</groupId>
  <artifactId>camel-sql-kafka-connector</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel Kafka connector version -->
</dependency>

To use this sink connector in Kafka connect you’ll need to set the following connector.class

connector.class=org.apache.camel.kafkaconnector.sql.CamelSqlSinkConnector

The camel-sql sink connector supports 21 options, which are listed below.

Name Description Default Priority

camel.sink.path.query

Required Sets the SQL query to perform. You can externalize the query by using file: or classpath: as prefix and specify the location of the file.

HIGH

camel.sink.endpoint.allowNamedParameters

Whether to allow using named parameters in the queries.

true

MEDIUM

camel.sink.endpoint.dataSource

Sets the DataSource to use to communicate with the database at endpoint level.

MEDIUM

camel.sink.endpoint.outputClass

Specify the full package and class name to use as conversion when outputType=SelectOne.

MEDIUM

camel.sink.endpoint.outputHeader

Store the query result in a header instead of the message body. By default, outputHeader == null and the query result is stored in the message body, any existing content in the message body is discarded. If outputHeader is set, the value is used as the name of the header to store the query result and the original message body is preserved.

MEDIUM

camel.sink.endpoint.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. (such as SELECT COUNT( ) FROM PROJECT will return a Long object. b) If the query has more than one column, then it will return a Map of that result. c) If the outputClass is set, then it will convert the query result into an Java bean object by calling all the setters that match the column names. It will assume your class has a default constructor to create instance with. d) If the query resulted in more than one rows, it throws an non-unique result exception. StreamList streams the result of the query using an Iterator. This can be used with the Splitter EIP in streaming mode to process the ResultSet in streaming fashion. One of: [SelectOne] [SelectList] [StreamList].

Enum values:

  • SelectOne

  • SelectList

  • StreamList

"SelectList"

MEDIUM

camel.sink.endpoint.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. Notice if you use named parameters, then a Map type is used instead. The default value is comma.

","

MEDIUM

camel.sink.endpoint.batch

Enables or disables batch mode.

false

MEDIUM

camel.sink.endpoint.lazyStartProducer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

MEDIUM

camel.sink.endpoint.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.

false

MEDIUM

camel.sink.endpoint.useMessageBodyForSql

Whether to use the message body as the SQL and then headers for parameters. If this option is enabled then the SQL in the uri is not used. Note that query parameters in the message body are represented by a question mark instead of a # symbol.

false

MEDIUM

camel.sink.endpoint.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. When this is false then the populateStatement is only invoked if there is 1 or more expected parameters to be set; for example this avoids reading the message body/headers for SQL queries with no parameters.

false

MEDIUM

camel.sink.endpoint.parametersCount

If set greater than zero, then Camel will use this count value of parameters to replace instead of querying via JDBC metadata API. This is useful if the JDBC vendor could not return correct parameters count, then user may override instead.

MEDIUM

camel.sink.endpoint.placeholder

Specifies a character that will be replaced to in SQL query. Notice, that it is simple String.replaceAll() operation and no SQL parsing is involved (quoted strings will also change).

"#"

MEDIUM

camel.sink.endpoint.prepareStatementStrategy

Allows to plugin to use a custom org.apache.camel.component.sql.SqlPrepareStatementStrategy to control preparation of the query and prepared statement.

MEDIUM

camel.sink.endpoint.templateOptions

Configures the Spring JdbcTemplate with the key/values from the Map.

MEDIUM

camel.sink.endpoint.usePlaceholder

Sets whether to use placeholder and replace all placeholder characters with sign in the SQL queries.

true

MEDIUM

camel.component.sql.dataSource

Sets the DataSource to use to communicate with the database.

MEDIUM

camel.component.sql.lazyStartProducer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

MEDIUM

camel.component.sql.autowiredEnabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

MEDIUM

camel.component.sql.usePlaceholder

Sets whether to use placeholder and replace all placeholder characters with sign in the SQL queries. This option is default true.

true

MEDIUM

The camel-sql sink connector has no converters out of the box.

The camel-sql sink connector has no transforms out of the box.

The camel-sql sink connector has no aggregation strategies out of the box.