This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-23789-wave2-multi-dsl-docs in repository https://gitbox.apache.org/repos/asf/camel.git
commit e2bc948961c0c9d38f4efcf7b4a33fc362763f03 Author: Claus Ibsen <[email protected]> AuthorDate: Thu Jun 18 11:58:32 2026 +0200 CAMEL-23789: Add multi-DSL tabs to medium-sized docs (Wave 2) Co-Authored-By: Claude <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../src/main/docs/dynamic-router-component.adoc | 12 ++ .../docs/dynamic-router-control-component.adoc | 14 ++ .../src/main/docs/hazelcast-map-component.adoc | 176 ++++++++++++++----- .../src/main/docs/metrics-component.adoc | 81 ++++++++- .../src/main/docs/micrometer-component.adoc | 12 ++ .../src/main/docs/mongodb-component.adoc | 193 +++++++++++++++++++-- 6 files changed, 433 insertions(+), 55 deletions(-) diff --git a/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc b/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc index ddfc71488609..aed31ee4a19e 100644 --- a/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc +++ b/components/camel-dynamic-router/src/main/docs/dynamic-router-component.adoc @@ -438,6 +438,8 @@ The Dynamic Router Control component supports some JMX operations that allow you It is beyond the scope of this document to go into detail about JMX, so this is a list of the operations that are supported. For more information about JMX, see the xref:manual::jmx.adoc[JMX] documentation. +._Java-only: JMX operation_ + .Subscribing with a predicate expression [source,java] ---- @@ -454,6 +456,8 @@ as follows: - expression language - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Subscribing with a predicate bean [source,java] ---- @@ -469,6 +473,8 @@ registry. The parameters, in order, are as follows: - predicate bean name - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Subscribing with a predicate instance [source,java] ---- @@ -484,6 +490,8 @@ are as follows: - predicate instance - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Unsubscribing [source,java] ---- @@ -494,6 +502,8 @@ This operation provides the ability to unsubscribe from a channel. The parameter - subscription ID - channel name +._Java-only: JMX operation_ + .Getting the subscriptions map [source,java] ---- @@ -502,6 +512,8 @@ Map<String, ConcurrentSkipListSet<PrioritizedFilter>> getSubscriptionsMap() This operation provides the ability to get the subscriptions map. The map is keyed by channel name, and the values are a set of prioritized filters. +._Java-only: JMX operation_ + .Getting the subscriptions statistics map [source,java] ---- diff --git a/components/camel-dynamic-router/src/main/docs/dynamic-router-control-component.adoc b/components/camel-dynamic-router/src/main/docs/dynamic-router-control-component.adoc index 8cf5ffa62f21..7c36cb8e4267 100644 --- a/components/camel-dynamic-router/src/main/docs/dynamic-router-control-component.adoc +++ b/components/camel-dynamic-router/src/main/docs/dynamic-router-control-component.adoc @@ -238,6 +238,8 @@ used to determine the suitability of exchanges for a participating recipient, wh predicates. Although it is advised to view the complete documentation, an example simple predicate might look like the following: +._Java-only: Predicate API_ + .Example simple predicate [source,java] ---- @@ -251,6 +253,8 @@ The Dynamic Router Control component supports some JMX operations that allow you It is beyond the scope of this document to go into detail about JMX, so this is a list of the operations that are supported. For more information about JMX, see the xref:manual::jmx.adoc[JMX] documentation. +._Java-only: JMX operation_ + .Subscribing with a predicate expression [source,java] ---- @@ -267,6 +271,8 @@ as follows: - expression language - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Subscribing with a predicate bean [source,java] ---- @@ -282,6 +288,8 @@ registry. The parameters, in order, are as follows: - predicate bean name - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Subscribing with a predicate instance [source,java] ---- @@ -297,6 +305,8 @@ are as follows: - predicate instance - update the subscription (true), or add a new one (false) +._Java-only: JMX operation_ + .Unsubscribing [source,java] ---- @@ -307,6 +317,8 @@ This operation provides the ability to unsubscribe from a channel. The parameter - subscription ID - channel name +._Java-only: JMX operation_ + .Getting the subscriptions map [source,java] ---- @@ -315,6 +327,8 @@ Map<String, ConcurrentSkipListSet<PrioritizedFilter>> getSubscriptionsMap() This operation provides the ability to get the subscriptions map. The map is keyed by channel name, and the values are a set of prioritized filters. +._Java-only: JMX operation_ + .Getting the subscriptions statistics map [source,java] ---- diff --git a/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc b/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc index b6cb45ca2aad..aaa0bba4fdcc 100644 --- a/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc +++ b/components/camel-hazelcast/src/main/docs/hazelcast-map-component.adoc @@ -50,6 +50,7 @@ The map cache producer provides follow operations specified by *CamelHazelcastOp You can call the samples with: +._Java-only: calling producer operations using ProducerTemplate_ [source,java] ---- template.sendBodyAndHeader("direct:[put|get|update|delete|query|evict]", "my-foo", HazelcastConstants.OBJECT_ID, "4711"); @@ -59,8 +60,7 @@ template.sendBodyAndHeader("direct:[put|get|update|delete|query|evict]", "my-foo [tabs] ==== - -Java DSL:: +Java:: + [source,java] ---- @@ -69,29 +69,41 @@ from("direct:put") .toF("hazelcast-%sfoo", HazelcastConstants.MAP_PREFIX); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:put" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:put"/> + <setHeader name="CamelHazelcastOperationType"> <constant>put</constant> </setHeader> - <to uri="hazelcast-map:foo" /> + <to uri="hazelcast-map:foo"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:put + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: put + - to: + uri: hazelcast-map:foo +---- ==== Sample for *put* with eviction: [tabs] ==== - -Java DSL:: +Java:: + - [source,java] ---- from("direct:put") @@ -101,33 +113,52 @@ from("direct:put") .toF("hazelcast-%sfoo", HazelcastConstants.MAP_PREFIX); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:put" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:put"/> + <setHeader name="CamelHazelcastOperationType"> <constant>put</constant> </setHeader> - <setHeader name="HazelcastConstants.TTL_VALUE"> - <simple resultType="java.lang.Long">1</simple> + <setHeader name="CamelHazelcastObjectTtlValue"> + <constant>1</constant> </setHeader> - <setHeader name="HazelcastConstants.TTL_UNIT"> - <simple resultType="java.util.concurrent.TimeUnit">TimeUnit.MINUTES</simple> + <setHeader name="CamelHazelcastObjectTtlUnit"> + <constant>MINUTES</constant> </setHeader> - <to uri="hazelcast-map:foo" /> + <to uri="hazelcast-map:foo"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:put + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: put + - setHeader: + name: CamelHazelcastObjectTtlValue + constant: 1 + - setHeader: + name: CamelHazelcastObjectTtlUnit + constant: MINUTES + - to: + uri: hazelcast-map:foo +---- ==== === Example for *get*: [tabs] ==== - -Java DSL:: +Java:: + [source,java] ---- @@ -137,28 +168,43 @@ from("direct:get") .to("seda:out"); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:get" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:get"/> + <setHeader name="CamelHazelcastOperationType"> <constant>get</constant> </setHeader> - <to uri="hazelcast-map:foo" /> - <to uri="seda:out" /> + <to uri="hazelcast-map:foo"/> + <to uri="seda:out"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:get + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: get + - to: + uri: hazelcast-map:foo + - to: + uri: seda:out +---- ==== === Example for *update*: [tabs] ==== - -Java DSL:: +Java:: + [source,java] ---- @@ -167,29 +213,41 @@ from("direct:update") .toF("hazelcast-%sfoo", HazelcastConstants.MAP_PREFIX); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:update" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:update"/> + <setHeader name="CamelHazelcastOperationType"> <constant>update</constant> </setHeader> - <to uri="hazelcast-map:foo" /> + <to uri="hazelcast-map:foo"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:update + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: update + - to: + uri: hazelcast-map:foo +---- ==== === Example for *delete*: [tabs] ==== - -Java DSL:: +Java:: + - [source,java] ---- from("direct:delete") @@ -197,27 +255,40 @@ from("direct:delete") .toF("hazelcast-%sfoo", HazelcastConstants.MAP_PREFIX); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:delete" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:delete"/> + <setHeader name="CamelHazelcastOperationType"> <constant>delete</constant> </setHeader> - <to uri="hazelcast-map:foo" /> + <to uri="hazelcast-map:foo"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:delete + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: delete + - to: + uri: hazelcast-map:foo +---- ==== === Example for *query* [tabs] ==== - -Java DSL:: +Java:: + [source,java] ---- @@ -227,25 +298,42 @@ from("direct:query") .to("seda:out"); ---- -Spring XML:: +XML:: + [source,xml] ---- <route> - <from uri="direct:query" /> - <setHeader name="hazelcast.operation.type"> + <from uri="direct:query"/> + <setHeader name="CamelHazelcastOperationType"> <constant>query</constant> </setHeader> - <to uri="hazelcast-map:foo" /> - <to uri="seda:out" /> + <to uri="hazelcast-map:foo"/> + <to uri="seda:out"/> </route> ---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:query + steps: + - setHeader: + name: CamelHazelcastOperationType + constant: query + - to: + uri: hazelcast-map:foo + - to: + uri: seda:out +---- ==== For the query operation Hazelcast offers an SQL like syntax to query your distributed map. +._Java-only: sending a query predicate using ProducerTemplate_ [source,java] ---- String q1 = "bar > 1000"; diff --git a/components/camel-metrics/src/main/docs/metrics-component.adoc b/components/camel-metrics/src/main/docs/metrics-component.adoc index 3121b466e7b4..54ca080557c8 100644 --- a/components/camel-metrics/src/main/docs/metrics-component.adoc +++ b/components/camel-metrics/src/main/docs/metrics-component.adoc @@ -531,15 +531,52 @@ component URI. |CamelMetricsHistogramValue |Override histogram value in URI |Long |================================================================= +[tabs] +==== +Java:: ++ [source,java] ---- // adds value 992 to simple.histogram from("direct:in") .setHeader(MetricsConstants.HEADER_HISTOGRAM_VALUE, constant(992L)) .to("metrics:histogram:simple.histogram?value=700") - .to("direct:out") + .to("direct:out"); +---- + +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:in"/> + <setHeader name="CamelMetricsHistogramValue"> + <constant resultType="java.lang.Long">992</constant> + </setHeader> + <to uri="metrics:histogram:simple.histogram?value=700"/> + <to uri="direct:out"/> +</route> +---- +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:in + steps: + - setHeader: + name: CamelMetricsHistogramValue + constant: 992 + - to: + uri: metrics:histogram:simple.histogram + parameters: + value: 700 + - to: + uri: direct:out ---- +==== [[MetricsComponent-meter]] === Metric type meter @@ -647,6 +684,10 @@ component URI. |CamelMetricsMeterMark |Override mark value in URI |Long |======================================================= +[tabs] +==== +Java:: ++ [source,java] ---- // updates meter simple.meter with value 345 @@ -656,6 +697,40 @@ from("direct:in") .to("direct:out"); ---- +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:in"/> + <setHeader name="CamelMetricsMeterMark"> + <constant resultType="java.lang.Long">345</constant> + </setHeader> + <to uri="metrics:meter:simple.meter?mark=123"/> + <to uri="direct:out"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:in + steps: + - setHeader: + name: CamelMetricsMeterMark + constant: 345 + - to: + uri: metrics:meter:simple.meter + parameters: + mark: 123 + - to: + uri: direct:out +---- +==== + [[MetricsComponent-timer]] === Metrics type timer @@ -914,6 +989,7 @@ want to instrument a few selected routes. From Java, you add the factory to the `CamelContext` as shown below: +._Java-only: adding MetricsRoutePolicyFactory to CamelContext_ [source,java] ---- context.addRoutePolicyFactory(new MetricsRoutePolicyFactory()); @@ -970,6 +1046,7 @@ the `com.codahale.metrics.MetricRegistry` from the `org.apache.camel.component.metrics.routepolicy.MetricsRegistryService` as shown below: +._Java-only: accessing MetricRegistry from MetricsRegistryService_ [source,java] ---- MetricRegistryService registryService = context.hasService(MetricsRegistryService.class); @@ -989,6 +1066,7 @@ the examples below demonstrates. From Java, you set the factory to the `CamelContext` as shown below: +._Java-only: setting MetricsMessageHistoryFactory on CamelContext_ [source,java] ---- context.setMessageHistoryFactory(new MetricsMessageHistoryFactory()); @@ -1044,6 +1122,7 @@ to gather the data as json output. From Java code, you can get the service from the CamelContext as shown: +._Java-only: dumping message history statistics as JSON_ [source,java] ---- MetricsMessageHistoryService service = context.hasService(MetricsMessageHistoryService.class); diff --git a/components/camel-micrometer/src/main/docs/micrometer-component.adoc b/components/camel-micrometer/src/main/docs/micrometer-component.adoc index 685ef2e56f04..53bb0b3cc276 100644 --- a/components/camel-micrometer/src/main/docs/micrometer-component.adoc +++ b/components/camel-micrometer/src/main/docs/micrometer-component.adoc @@ -99,6 +99,8 @@ To use the legacy naming, then you can use the `LEGACY` naming from the `xxxNami For example: +._Java-only: configuring legacy naming strategy on the route policy factory_ + [source,java] ---- MicrometerRoutePolicyFactory factory = new MicrometerRoutePolicyFactory(); @@ -740,6 +742,8 @@ want to instrument a few selected routes. From Java, you add the factory to the `CamelContext` as shown below: +._Java-only: adding MicrometerRoutePolicyFactory to the CamelContext_ + [source,java] ---- context.addRoutePolicyFactory(new MicrometerRoutePolicyFactory()); @@ -798,6 +802,8 @@ the examples below demonstrates. From Java, you set the factory to the `CamelContext` as shown below: +._Java-only: setting MicrometerMessageHistoryFactory on the CamelContext_ + [source,java] ---- context.setMessageHistoryFactory(new MicrometerMessageHistoryFactory()); @@ -827,6 +833,8 @@ to gather the data as json output. From Java code, you can get the service from the CamelContext as shown: +._Java-only: accessing MicrometerMessageHistoryService from the CamelContext_ + [source,java] ---- MicrometerMessageHistoryService service = context.hasService(MicrometerMessageHistoryService.class); @@ -843,6 +851,8 @@ There is a `MicrometerRouteEventNotifier` (counting added and running routes) an EventNotifiers can be added to the CamelContext, e.g.: +._Java-only: adding MicrometerExchangeEventNotifier to the CamelContext_ + [source,java] ---- camelContext.getManagementStrategy().addEventNotifier(new MicrometerExchangeEventNotifier()); @@ -854,6 +864,8 @@ to gather the data as json output. From Java code, you can get the service from the CamelContext as shown: +._Java-only: accessing MicrometerEventNotifierService from the CamelContext_ + [source,java] ---- MicrometerEventNotifierService service = context.hasService(MicrometerEventNotifierService.class); diff --git a/components/camel-mongodb/src/main/docs/mongodb-component.adoc b/components/camel-mongodb/src/main/docs/mongodb-component.adoc index 0645e590de8b..cb7d1301e31d 100644 --- a/components/camel-mongodb/src/main/docs/mongodb-component.adoc +++ b/components/camel-mongodb/src/main/docs/mongodb-component.adoc @@ -158,6 +158,10 @@ YAML:: Please note that the default _id is treated by Mongo as and `ObjectId` type, so you may need to convert it properly. +[tabs] +==== +Java:: ++ [source,java] ---- from("direct:findById") @@ -166,6 +170,39 @@ from("direct:findById") .to("mock:resultFindById"); ---- +XML:: ++ +[source,xml] +---- +<route> + <from uri="direct:findById"/> + <convertBodyTo type="org.bson.types.ObjectId"/> + <to uri="mongodb:myDb?database=flights&collection=tickets&operation=findById"/> + <to uri="mock:resultFindById"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + from: + uri: direct:findById + steps: + - convertBodyTo: + type: org.bson.types.ObjectId + - to: + uri: mongodb:myDb + parameters: + database: flights + collection: tickets + operation: findById + - to: + uri: mock:resultFindById +---- +==== + [TIP] ==== *Supports optional parameters* @@ -825,6 +862,8 @@ which displays useful statistic figures about the database. + Usage example: +._Java-only: Java test API (ProducerTemplate)_ + [source,java] ---- // from("direct:getDbStats").to("mongodb:myDb?database=flights&collection=tickets&operation=getDbStats"); @@ -864,6 +903,8 @@ shell, which displays useful statistic figures about the collection. + Usage example: +._Java-only: Java test API (ProducerTemplate)_ + [source,java] ---- // from("direct:getColStats").to("mongodb:myDb?database=flights&collection=tickets&operation=getColStats"); @@ -881,6 +922,8 @@ getting host information, replication or sharding status. Collection parameter is not used for this operation. +._Java-only: Java test API (ProducerTemplate)_ + [source,java] ---- // route: from("command").to("mongodb:myDb?database=science&operation=command"); @@ -973,6 +1016,10 @@ value of 1000ms.), which you can modify to suit your needs. An example: +[tabs] +==== +Java:: ++ [source,java] ---- from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime") @@ -981,6 +1028,35 @@ from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasing .to("mock:test"); ---- +XML:: ++ +[source,xml] +---- +<route id="tailableCursorConsumer1" autoStartup="false"> + <from uri="mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime"/> + <to uri="mock:test"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + id: tailableCursorConsumer1 + autoStartup: false + from: + uri: mongodb:myDb + parameters: + database: flights + collection: cancellations + tailTrackIncreasingField: departureTime + steps: + - to: + uri: mock:test +---- +==== + The above route will consume from the `flights.cancellations` capped collection, using `departureTime` as the increasing field, with a default regeneration cursor delay of 1000ms. @@ -1027,30 +1103,103 @@ with persistent tail tracking turned on, and persisting under the the last processed value under the "lastTrackingValue" field (`camelTailTracking` and `lastTrackingValue` are defaults). +[tabs] +==== +Java:: ++ [source,java] ---- -from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true" + +from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true" + "&persistentId=cancellationsTracker") .id("tailableCursorConsumer2") .autoStartup(false) .to("mock:test"); ---- +XML:: ++ +[source,xml] +---- +<route id="tailableCursorConsumer2" autoStartup="false"> + <from uri="mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true&persistentId=cancellationsTracker"/> + <to uri="mock:test"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + id: tailableCursorConsumer2 + autoStartup: false + from: + uri: mongodb:myDb + parameters: + database: flights + collection: cancellations + tailTrackIncreasingField: departureTime + persistentTailTracking: true + persistentId: cancellationsTracker + steps: + - to: + uri: mock:test +---- +==== + Below is another example identical to the one above, but where the persistent tail tracking runtime information will be stored under the "trackers.camelTrackers" collection, in the "lastProcessedDepartureTime" field: +[tabs] +==== +Java:: ++ [source,java] ---- -from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true" + - "&persistentId=cancellationsTracker&tailTrackDb=trackers&tailTrackCollection=camelTrackers" + +from("mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true" + + "&persistentId=cancellationsTracker&tailTrackDb=trackers&tailTrackCollection=camelTrackers" + "&tailTrackField=lastProcessedDepartureTime") .id("tailableCursorConsumer3") .autoStartup(false) .to("mock:test"); ---- +XML:: ++ +[source,xml] +---- +<route id="tailableCursorConsumer3" autoStartup="false"> + <from uri="mongodb:myDb?database=flights&collection=cancellations&tailTrackIncreasingField=departureTime&persistentTailTracking=true&persistentId=cancellationsTracker&tailTrackDb=trackers&tailTrackCollection=camelTrackers&tailTrackField=lastProcessedDepartureTime"/> + <to uri="mock:test"/> +</route> +---- + +YAML:: ++ +[source,yaml] +---- +- route: + id: tailableCursorConsumer3 + autoStartup: false + from: + uri: mongodb:myDb + parameters: + database: flights + collection: cancellations + tailTrackIncreasingField: departureTime + persistentTailTracking: true + persistentId: cancellationsTracker + tailTrackDb: trackers + tailTrackCollection: camelTrackers + tailTrackField: lastProcessedDepartureTime + steps: + - to: + uri: mock:test +---- +==== + ==== Change Streams Consumer Change Streams allow applications to access real-time data changes without the complexity and risk of tailing the MongoDB oplog. @@ -1061,22 +1210,46 @@ The exchange body will contain the full document of any change. To configure Change Streams Consumer you need to specify `consumerType`, `database`, `collection` and optional JSON property `streamFilter` to filter events. That JSON property is standard MongoDB `$match` aggregation. -It could be easily specified using XML DSL configuration: +It could be easily specified using the DSL configuration: + +[tabs] +==== +Java:: ++ +[source,java] +---- +from("mongodb:myDb?consumerType=changeStreams&database=flights&collection=tickets&streamFilter={ '$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]} }") + .to("mock:test"); +---- +XML:: ++ [source,xml] ---- <route id="filterConsumer"> - <from uri="mongodb:myDb?consumerType=changeStreams&database=flights&collection=tickets&streamFilter={ '$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]} }"/> - <to uri="mock:test"/> + <from uri="mongodb:myDb?consumerType=changeStreams&database=flights&collection=tickets&streamFilter={ '$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]} }"/> + <to uri="mock:test"/> </route> ---- -Java configuration: -[source,java] +YAML:: ++ +[source,yaml] ---- -from("mongodb:myDb?consumerType=changeStreams&database=flights&collection=tickets&streamFilter={ '$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]} }") - .to("mock:test"); +- route: + id: filterConsumer + from: + uri: mongodb:myDb + parameters: + consumerType: changeStreams + database: flights + collection: tickets + streamFilter: "{ '$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]} }" + steps: + - to: + uri: mock:test ---- +==== TIP: You can externalize the streamFilter value into a property placeholder which allows the endpoint URI parameters to be _cleaner_ and easier to read.
