从 spring-cloud-streams 推到 aws-kinesis 时,是什么导致了额外的 headers?

What is causing extra headers when pushing from spring-cloud-streams to aws-kinesis?

示例: 我正在推送到输出流

Message<String> message = MessageBuilder.withPayload(MY-STRING).build();
processor.output().send(message);

然后进入 Kinesis 流,在 Firehose 的 S3 中结束。 当我查看文件时,它们具有以下 header 信息:

<FF>^A^KcontentType^@^@^@^Z"text/plain;charset=UTF-8 MY-STRING

这看起来很奇怪,因为我们有一些基于 Python 的制作人,其中 none 添加了这样的 header - 只是文本。

是什么导致了这种行为?有什么设置可以关掉吗?我们只想要文本字符串。

将生产者 headerMode 设置为 none

https://docs.spring.io/spring-cloud-stream/docs/3.1.2/reference/html/spring-cloud-stream.html#_producer_properties

headerMode

When set to none, it disables header embedding on output. It is effective only for messaging middleware that does not support message headers natively and requires header embedding. This option is useful when producing data for non-Spring Cloud Stream applications when native headers are not supported. When set to headers, it uses the middleware’s native header mechanism. When set to embeddedHeaders, it embeds headers into the message payload.

Default: Depends on the binder implementation.

看来 embeddedHeaders 是该活页夹的默认值...

https://github.com/spring-cloud/spring-cloud-stream-binder-aws-kinesis/blob/57c926f4142feed545224ce3a244d9c20e2b6287/spring-cloud-stream-binder-kinesis/src/main/java/org/springframework/cloud/stream/binder/kinesis/provisioning/KinesisStreamProvisioner.java#L88-L90