为什么 Spring 集成中的 TIMESTAMP 和 ID headers 在 Spring Kafka 中未映射?
Why are the TIMESTAMP and ID headers from Spring Integration unmapped in Spring Kafka?
测试失败的示例项目位于 https://github.com/phillipuniverse/kafka-headers-test。
令我感到奇怪的是,来自 Spring 集成的 ID
和 TIMESTAMP
headers 正在被删除,因为它们不能用于接收消息.这是一个错误吗?
我遇到了一个相关问题 ,其中提到这些 header 是短暂的,这让我认为这种行为是故意的。为什么它们是短暂的?为什么这些不像其他所有自定义 header 都正确映射?特殊待遇有特殊原因吗?
这样做是出于性能原因,因为在某些高容量情况下,id 和时间戳的生成会影响性能。
您可以使用 standardHeaders
consumer property:
更改行为
standardHeaders
Indicates which standard headers are populated by the inbound channel adapter. Allowed values: none
, id
, timestamp
, or both
. Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).
Default: none
测试失败的示例项目位于 https://github.com/phillipuniverse/kafka-headers-test。
令我感到奇怪的是,来自 Spring 集成的 ID
和 TIMESTAMP
headers 正在被删除,因为它们不能用于接收消息.这是一个错误吗?
我遇到了一个相关问题
这样做是出于性能原因,因为在某些高容量情况下,id 和时间戳的生成会影响性能。
您可以使用 standardHeaders
consumer property:
standardHeaders
Indicates which standard headers are populated by the inbound channel adapter. Allowed values:
none
,id
,timestamp
, orboth
. Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).Default: none