在春云流中设置带句点的主题内容类型



我有一个春季云流应用程序(Finchley.SR1(,其主题的名称中带有句点。在 application.properties 中,我想设置不同主题的内容类型,但由于主题中有句点,因此无法按预期工作。

我的应用程序属性如下所示:

spring.cloud.stream.bindings.topic1.with.periods.content-type=application/topic1
spring.cloud.stream.bindings.topic2.with.periods.content-type=application/topic2
spring.cloud.stream.default.content-type=application/other

我的所有邮件都以内容类型设置为application/other而不是设置正确的内容类型标头。我也尝试过使用contentType而不是content-type,但这也不起作用。

为什么那里需要句号?

可以使用简单名称命名绑定,并将destination设置为虚线名称。

@Output("foo")
MessageChannel foo();

然后

spring.cloud.stream.bindings.foo.destination=topic1.with.periods
spring.cloud.stream.bindings.foo.content-type=application/topic1

最新更新