camel-mongodb-kafka-connector source configuration

Connector description: Perform operations on MongoDB documents and collections.

When using camel-mongodb-kafka-connector as source 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 Source connector in Kafka connect you’ll need to set the following connector.class

connector.class=org.apache.camel.kafkaconnector.mongodb.CamelMongodbSourceConnector

The camel-mongodb source connector supports 27 options, which are listed below.

Name Description Default Required Priority

camel.source.path.connectionBean

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

null

true

HIGH

camel.source.endpoint.collection

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

null

false

MEDIUM

camel.source.endpoint.collectionIndex

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

null

false

MEDIUM

camel.source.endpoint.createCollection

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

true

false

MEDIUM

camel.source.endpoint.database

Sets the name of the MongoDB database to target

null

false

MEDIUM

camel.source.endpoint.mongoConnection

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

null

false

MEDIUM

camel.source.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.source.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.source.endpoint.bridgeErrorHandler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

false

MEDIUM

camel.source.endpoint.consumerType

Consumer type.

null

false

MEDIUM

camel.source.endpoint.exceptionHandler

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

null

false

MEDIUM

camel.source.endpoint.exchangePattern

Sets the exchange pattern when the consumer creates an exchange. One of: [InOnly] [InOut] [InOptionalOut]

null

false

MEDIUM

camel.source.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.source.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.source.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.source.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.source.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.source.endpoint.streamFilter

Filter condition for change streams consumer.

null

false

MEDIUM

camel.source.endpoint.persistentId

One tail tracking collection can host many trackers for several tailable consumers. To keep them separate, each tracker should have its own unique persistentId.

null

false

MEDIUM

camel.source.endpoint.persistentTailTracking

Enable persistent tail tracking, which is a mechanism to keep track of the last consumed message across system restarts. The next time the system is up, the endpoint will recover the cursor from the point where it last stopped slurping records.

false

false

MEDIUM

camel.source.endpoint.tailTrackCollection

Collection where tail tracking information will be persisted. If not specified, MongoDbTailTrackingConfig#DEFAULT_COLLECTION will be used by default.

null

false

MEDIUM

camel.source.endpoint.tailTrackDb

Indicates what database the tail tracking mechanism will persist to. If not specified, the current database will be picked by default. Dynamicity will not be taken into account even if enabled, i.e. the tail tracking database will not vary past endpoint initialisation.

null

false

MEDIUM

camel.source.endpoint.tailTrackField

Field where the last tracked value will be placed. If not specified, MongoDbTailTrackingConfig#DEFAULT_FIELD will be used by default.

null

false

MEDIUM

camel.source.endpoint.tailTrackIncreasingField

Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every time it is generated. The cursor will be (re)created with a query of type: tailTrackIncreasingField greater than lastValue (possibly recovered from persistent tail tracking). Can be of type Integer, Date, String, etc. NOTE: No support for dot notation at the current time, so the field should be at the top level of the document.

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.bridgeErrorHandler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

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 source connector has no converters out of the box.

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

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