GH-3089: Add AmqpInGateway.replyHeadersMappedLast (#3091)
* GH-3089: Add AmqpInGateway.replyHeadersMappedLast Fixes https://github.com/spring-projects/spring-integration/issues/3089 In some use-case we would like to control when headers from SI message should be populated into an AMQP message. One of the use-case is like a `SimpleMessageConverter` and its `plain/text` for the String reply, meanwhile we know that this content is an `application/json`. So, with a new `replyHeadersMappedLast` we can override the mentioned `content-type` header, populated by the `MessageConverter` with an actual value from the message headers populated in the flow upstream * Introduce an `AmqpInboundGateway.replyHeadersMappedLast`; expose it on the DSL and XML level * Use newly introduced `MappingUtils.mapReplyMessage()` * Optimize `DefaultAmqpHeaderMapper` to not parse JSON headers at all when `JsonHeaders.TYPE_ID` is already present (e.g. `MessageConverter` result) * Also skip `JsonHeaders` when we `populateUserDefinedHeader()` **Cherry-pick to 5.1.x** * * Fix language and package typos * Add missed `@param` in JavaDoc of the `AmqpBaseInboundGatewaySpec.batchingStrategy()` * Extract a `RabbitTemplate` `MessageConverter` to use for reply messages conversion - pursue a backward compatibility
This commit is contained in:
committed by
Gary Russell
parent
977997e3bf
commit
6468ecc530
@@ -1196,6 +1196,9 @@ The `ObjectToJsonTransformer` does exactly that (by default).
|
||||
|
||||
There is now a property called `headersMappedLast` on the outbound channel adapter and gateway (as well as on AMQP-backed channels).
|
||||
Setting this to `true` restores the behavior of overwriting the property added by the converter.
|
||||
|
||||
Starting with version 5.1.9, a similar `replyHeadersMappedLast` is provided for the `AmqpInboundGateway` when we produce a reply and would like to override headers populated by the converter.
|
||||
See its JavaDocs for more information.
|
||||
====
|
||||
|
||||
[[amqp-user-id]]
|
||||
|
||||
Reference in New Issue
Block a user