camel-mongodb-kafka-connector sink configuration

Connector Description: Perform operations on MongoDB documents and collections.

When using camel-mongodb-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-mongodb-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.mongodb.CamelMongodbSinkConnector

The camel-mongodb sink connector supports 20 options, which are listed below.

Name Description Default Required Priority

camel.sink.path.connectionBean

Sets the connection bean reference used to lookup a client for connecting to a database.

null

true

HIGH

camel.sink.endpoint.collection

Sets the name of the MongoDB collection to bind to this endpoint

null

false

MEDIUM

camel.sink.endpoint.collectionIndex

Sets the collection index (JSON FORMAT : { field1 : order1, field2 : order2})

null

false

MEDIUM

camel.sink.endpoint.createCollection

Create collection during initialisation if it doesn’t exist. Default is true.

true

false

MEDIUM

camel.sink.endpoint.database

Sets the name of the MongoDB database to target

null

false

MEDIUM

camel.sink.endpoint.hosts

Host address of mongodb server in host:port format. It’s possible also use more than one address, as comma separated list of hosts: host1:port1,host2:port2. If hosts parameter is specified, provided connectionBean is ignored.

null

false

MEDIUM

camel.sink.endpoint.mongoConnection

Sets the connection bean used as a client for connecting to a database.

null

false

MEDIUM

camel.sink.endpoint.operation

Sets the operation this endpoint will execute against MongoDB. One of: [findById] [findOneByQuery] [findAll] [findDistinct] [insert] [save] [update] [remove] [bulkWrite] [aggregate] [getDbStats] [getColStats] [count] [command]

null

false

MEDIUM

camel.sink.endpoint.outputType

Convert the output of the producer to the selected type : DocumentList Document or MongoIterable. DocumentList or MongoIterable applies to findAll and aggregate. Document applies to all other operations. One of: [DocumentList] [Document] [MongoIterable]

null

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

false

MEDIUM

camel.sink.endpoint.cursorRegenerationDelay

MongoDB tailable cursors will block until new data arrives. If no new data is inserted, after some time the cursor will be automatically freed and closed by the MongoDB server. The client is expected to regenerate the cursor if needed. This value specifies the time to wait before attempting to fetch a new cursor, and if the attempt fails, how long before the next attempt is made. Default value is 1000ms.

1000L

false

MEDIUM

camel.sink.endpoint.dynamicity

Sets whether this endpoint will attempt to dynamically resolve the target database and collection from the incoming Exchange properties. Can be used to override at runtime the database and collection specified on the otherwise static endpoint URI. It is disabled by default to boost performance. Enabling it will take a minimal performance hit.

false

false

MEDIUM

camel.sink.endpoint.readPreference

Configure how MongoDB clients route read operations to the members of a replica set. Possible values are PRIMARY, PRIMARY_PREFERRED, SECONDARY, SECONDARY_PREFERRED or NEAREST One of: [PRIMARY] [PRIMARY_PREFERRED] [SECONDARY] [SECONDARY_PREFERRED] [NEAREST]

"PRIMARY"

false

MEDIUM

camel.sink.endpoint.writeConcern

Configure the connection bean with the level of acknowledgment requested from MongoDB for write operations to a standalone mongod, replicaset or cluster. Possible values are ACKNOWLEDGED, W1, W2, W3, UNACKNOWLEDGED, JOURNALED or MAJORITY. One of: [ACKNOWLEDGED] [W1] [W2] [W3] [UNACKNOWLEDGED] [JOURNALED] [MAJORITY]

"ACKNOWLEDGED"

false

MEDIUM

camel.sink.endpoint.writeResultAsHeader

In write operations, it determines whether instead of returning WriteResult as the body of the OUT message, we transfer the IN message to the OUT and attach the WriteResult as a header.

false

false

MEDIUM

camel.sink.endpoint.password

User password for mongodb connection

null

false

MEDIUM

camel.sink.endpoint.username

Username for mongodb connection

null

false

MEDIUM

camel.component.mongodb.mongoConnection

Shared client used for connection. All endpoints generated from the component will share this connection client.

null

false

MEDIUM

camel.component.mongodb.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

false

MEDIUM

camel.component.mongodb.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

false

MEDIUM

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

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

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