230.7.2. 更改 Streams Consumer
通过更改流,应用程序就可以访问实时数据更改,而无需跟踪 MongoDB oplog 的复杂性和风险。应用程序可以使用更改流来订阅集合上的所有数据更改,并立即对其做出反应。由于更改流使用聚合框架,应用程序也可以过滤特定更改或转换通知。
					要配置 Change Streams Consumer,您需要指定 consumerType、数据库、收集和 可选的 JSON 属性 streamFilter 来过滤事件。该 JSON 属性是标准 MongoDB $match 聚合。它可以通过 XML DSL 配置轻松指定:
				
Java 配置:
from("mongodb3:myDb?consumerType=changeStreams&database=flights&collection=tickets")
    .routeProperty("streamFilter", "{'$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]}}")
    .to("mock:test");
from("mongodb3:myDb?consumerType=changeStreams&database=flights&collection=tickets")
    .routeProperty("streamFilter", "{'$match':{'$or':[{'fullDocument.stringValue': 'specificValue'}]}}")
    .to("mock:test");