Component for working with documents stored in MongoDB database.
Name | Kind | Group | Required | Default | Type | Enum | Description |
---|---|---|---|---|---|---|---|
connectionBean | path | common | true | java.lang.String | Name of {@link com.mongodb.Mongo} to use. | ||
collection | parameter | common | java.lang.String | Sets the name of the MongoDB collection to bind to this endpoint @param collection collection name | |||
collectionIndex | parameter | common | java.lang.String | Sets the collection index (JSON FORMAT : { "field1" : order1, "field2" : order2}) | |||
createCollection | parameter | common | true | boolean | Create collection during initialisation if it doesn't exist. Default is true. @param createCollection true or false | ||
database | parameter | common | java.lang.String | Sets the name of the MongoDB database to target @param database name of the MongoDB database | |||
operation | parameter | common | org.apache.camel.component.mongodb.MongoDbOperation | findById findOneByQuery findAll insert save update remove aggregate getDbStats getColStats count command |
Sets the operation this endpoint will execute against MongoDB. For possible values, see {@link MongoDbOperation}. @param operation name of the operation as per catalogued values @throws CamelMongoDbException | ||
outputType | parameter | common | org.apache.camel.component.mongodb.MongoDbOutputType | DBObjectList DBObject DBCursor |
Convert the output of the producer to the selected type : "DBObjectList", "DBObject" or "DBCursor". DBObjectList or DBObject applies to findAll. DBCursor applies to all other operations. @param outputType | ||
writeConcern | parameter | common | ACKNOWLEDGED | com.mongodb.WriteConcern | ACKNOWLEDGED W1 W2 W3 UNACKNOWLEDGED JOURNALED MAJORITY SAFE |
Set the {@link WriteConcern} for write operations on MongoDB using the standard ones. Resolved from the fields of the WriteConcern class by calling the {@link WriteConcern#valueOf(String)} method. @param writeConcern the standard name of the WriteConcern @see possible options | |
bridgeErrorHandler | parameter | consumer | boolean | 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/ERROR level and ignored. | |||
exceptionHandler | parameter | consumer (advanced) | org.apache.camel.spi.ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored. | |||
exchangePattern | parameter | consumer (advanced) | org.apache.camel.ExchangePattern | InOnly RobustInOnly InOut InOptionalOut OutOnly RobustOutOnly OutIn OutOptionalIn |
Sets the exchange pattern when the consumer creates an exchange. | ||
cursorRegenerationDelay | parameter | advanced | 1000 | long | 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. @param cursorRegenerationDelay delay specified in milliseconds | ||
dynamicity | parameter | advanced | boolean | 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. @see MongoDbConstants#DATABASE @see MongoDbConstants#COLLECTION @param dynamicity true or false indicated whether target database and collection should be calculated dynamically based on Exchange properties. | |||
readPreference | parameter | advanced | com.mongodb.ReadPreference | Sets a MongoDB {@link ReadPreference} on the Mongo connection. Read preferences set directly on the connection will be overridden by this setting. The {@link com.mongodb.ReadPreference#valueOf(String)} utility method is used to resolve the passed {@code readPreference} value. Some examples for the possible values are {@code nearest}, {@code primary} or {@code secondary} etc. @param readPreference the name of the read preference to set | |||
synchronous | parameter | advanced | false | boolean | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | ||
writeResultAsHeader | parameter | advanced | boolean | In write operations, it determines whether instead of returning {@link WriteResult} as the body of the OUT message, we transfer the IN message to the OUT and attach the WriteResult as a header. @param writeResultAsHeader flag to indicate if this option is enabled | |||
persistentId | parameter | tail | java.lang.String | One tail tracking collection can host many trackers for several tailable consumers. To keep them separate, each tracker should have its own unique persistentId. @param persistentId the value of the persistent ID to use for this tailable consumer | |||
persistentTailTracking | parameter | tail | boolean | 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. @param persistentTailTracking true or false | |||
tailTrackCollection | parameter | tail | java.lang.String | Collection where tail tracking information will be persisted. If not specified, {@link MongoDbTailTrackingConfig#DEFAULT_COLLECTION} will be used by default. @param tailTrackCollection collection name | |||
tailTrackDb | parameter | tail | java.lang.String | 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. @param tailTrackDb database name | |||
tailTrackField | parameter | tail | java.lang.String | Field where the last tracked value will be placed. If not specified, {@link MongoDbTailTrackingConfig#DEFAULT_FIELD} will be used by default. @param tailTrackField field name | |||
tailTrackIncreasingField | parameter | tail | java.lang.String | 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 > 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. @param tailTrackIncreasingField |
The MongoDb consumer.