简体   繁体   English

如何重命名 debezium mongodb 连接器发件箱消息的 id 标头

[英]How to rename the id header of a debezium mongodb connector outbox message

I am trying to use the outbox event router of debezium for mongodb.我正在尝试将 debezium 的发件箱事件路由器用于 mongodb。 The consumer is a spring cloud stream application.消费者是一个 Spring Cloud Stream 应用程序。 I cannot deserialize the message because spring cloud expects the message id header to be UUID, but it receives byte[].我无法反序列化消息,因为 spring cloud 期望消息 id 标头是 UUID,但它接收到 byte[]。 I have tried different deserializers to no avail.我尝试了不同的反序列化器无济于事。 I am thinking of renaming the id header in order to skip this spring cloud check, or remove it altogether.我正在考虑重命名 id 标头以跳过此春季云检查,或完全删除它。 I have tried the ReplaceField SMT but it does not seem to modify the header fields.我已经尝试过 ReplaceField SMT,但它似乎没有修改标题字段。

Also is there a way to overcome this in spring?春天有没有办法克服这个问题?

The solution to the initial question is to use the DropHeaders SMT( https://docs.confluent.io/platform/current/connect/transforms/dropheaders.html ).最初问题的解决方案是使用 DropHeaders SMT( https://docs.confluent.io/platform/current/connect/transforms/dropheaders.html )。 This will remove the id header that is populated by debezium.这将删除由 debezium 填充的 id 标头。

But as Oleg Zhurakousky mentioned, moving to a newer version of spring-cloud-stream without @StreamListener solves the underlying problem.但正如 Oleg Zhurakousky 所提到的,在没有 @StreamListener 的情况下迁移到新版本的 spring-cloud-stream 可以解决根本问题。 Apparently @StreamListener checks if a message has an id header and it demands to be of type Uuid.显然,@StreamListener 检查消息是否具有 id 标头,并且它要求是 Uuid 类型。 By using the new functional way of working with spring-cloud-stream, the id header is actually overwritten with a new generated value.通过使用 spring-cloud-stream 的新功能方式,id 标头实际上被新生成的值覆盖。 This means that the value populated by debezium (the id column form the outbox table) is ignored.这意味着由 debezium 填充的值(发件箱表中的 id 列)将被忽略。 I guess if you need to check for duplicate delivery, maybe it is better to create your own header instead of using the id.我想如果您需要检查重复交付,也许最好创建自己的标题而不是使用 id。 I do not know if spring-cloud-stream generates the same id for the same message if it is redelivered.我不知道 spring-cloud-stream 是否会为相同的消息生成相同的 id,如果它被重新传递。

Also keep in mind that even in the newer versions of spring-cloud-stream, if you use the deprecated @StreamListener, you will have the same problem.还要记住,即使在较新版本的 spring-cloud-stream 中,如果您使用已弃用的 @StreamListener,您也会遇到同样的问题。

暂无
暂无

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

相关问题 kafka 连接器 debezium mongodb CDC 更新/$set 消息没有过滤器(_id 值) - kafka connector debezium mongodb CDC update/$set message without filter(_id value) 带卡夫卡和 mongoDB 连接器的发件箱模式 - Outbox pattern with kafka and mongoDB connector Debezium Kafka连接器mongodb - Debezium Kafka connector mongodb 如何使用 Debezium MongoDB 源连接器将 JSON 值转换为 Kafka 消息密钥? - How to transform JSON value to Kafka message key with Debezium MongoDB Source Connector? 如何在spring-boot中和之前为mongoDB编写Debezium Connector Configuration和Debezium Listener,在payload作为JSON之后? - How to write Debezium Connector Configuration and Debezium Listener for mongoDB in spring-boot and before, after payload as JSON? 如何在创建 debezium mongodb kafka 连接器时通过 MongoDB tls 证书? - how to pass MongoDB tls certificates while creating debezium mongodb kafka connector? 我们如何从具有debezium kafka连接器的副本集中的辅助mongodb节点中截取oplog? - How could we tail oplog from a secondary mongodb node in a replica set with debezium kafka connector? 通过debezium mongodb连接器连接到mongodb时身份验证失败 - Authentication failed when connected to mongodb by debezium mongodb connector 如何配置 Debezium 的 MongoDB 源连接器以按照 Postgres JDBC 接收器连接器的预期发送 record_value 中的 pk 字段 - How can I configure Debezium's MongoDB source connector to send the pk fields in the record_value as expected by the Postgres JDBC sink connector Debezium mongodb kafka 连接器没有像 mongodb 那样在主题中产生一些记录 - Debezium mongodb kafka connector not producing some of records in topic as it is in mongodb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM