简体   繁体   English

在 MongoDB Kafka 源连接器中配置 Pipeline

[英]Configure Pipeline in MongoDB Kafka source connector

I am using following configuration for source connector to filter and read only specific records with status as "PENDING" from MongoDB.我正在使用以下源连接器配置来过滤和读取 MongoDB 中状态为“PENDING”的特定记录。 Need to poll all records that are inserted/updated with PENDING status only.只需要轮询所有插入/更新为 PENDING 状态的记录。 Source connector able to poll all records if pipeline is excluded.如果排除管道,源连接器能够轮询所有记录。 Can someone help me understand how to fix this and also is there a way to know that polling is completed like batch job is completed to orchestrate another process on kafka consumer?有人可以帮我理解如何解决这个问题,还有没有办法知道轮询已经完成,就像批处理作业完成一样,以协调 kafka 消费者的另一个进程?

name=mongo-source-demo
connector.class=com.mongodb.kafka.connect.MongoSourceConnector
tasks.max=1
# Connection and source configuration
connection.uri=mongodb://username:password@hostname:27017
database=test
collection=mongoDBtest
topic.prefix=mongodb.connector
poll.max.batch.size=1000
poll.await.time.ms=100000
publish.full.document.only=true
pipeline=[{"$match": { "Status" : "PENDING" }},{"$project":{"_id":1,"fullDocument":1}} ]

The problem is with the "" in the MongoDB operators.问题在于 MongoDB 运算符中的“”。 The correct pipeline configuration should be:正确的管道配置应该是:

pipeline=[{$match: { "Status" : "PENDING" }},{$project:{"_id":1,"fullDocument":1}} ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM