是否可以在传出消息中设置 AMQP 消息属性?

Is it possible to set up AMQP message properties in outgoing message?

我正在使用 Spring Cloud Stream 和 RabbitMQ 活页夹。我需要调用不使用 Spring Cloud Stream 的外部服务。此服务正在使用 typecorrelation_id 消息属性。

我尝试在外发消息中设置 headers,但是,即使属性在技术上是 headers,它们也会以特殊方式处理。所以设置 type header 不会设置 属性.

我知道拦截器,如果只使用 Spring RabbitMq,那不会有问题。但是由于 Spring Cloud Stream 代表了更高级别的抽象,所有活页夹特定设置都被隐藏了。

是否可以在传出流消息中设置 RabbitMQ 属性?

属性映射自消息 headers,由 AmqpHeaders 常量键入;在这种情况下 AmqpHeaders.TYPE (amqp_type) 和 AmqpHeaders.CORRELATION_ID (amqp_correlationId).

所有 "unknown" 消息 headers 都映射为兔子 headers。