-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-3089: Add AmqpInGateway.replyHeadersMappedLast #3091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
garyrussell
suggested changes
Oct 31, 2019
...tion-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* Map a reply o.s.Message to an o.s.a.core.Message. When using a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o.s.m.Message
Fixes spring-projects#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**
* Add missed `@param` in JavaDoc of the `AmqpBaseInboundGatewaySpec.batchingStrategy()` * Extract a `RabbitTemplate` `MessageConverter` to use for reply messages conversion - pursue a backward compatibility
Pushed. Please, take a look! |
garyrussell
approved these changes
Oct 31, 2019
garyrussell
pushed a commit
that referenced
this pull request
Oct 31, 2019
* GH-3089: Add AmqpInGateway.replyHeadersMappedLast Fixes #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
And cherry-picked as 54de7a2 after resolving conflicts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #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 itsplain/text
for the String reply, meanwhile we know that this content is an
application/json
.So, with a new
replyHeadersMappedLast
we can override the mentionedcontent-type
header, populated by theMessageConverter
with anactual value from the message headers populated in the flow upstream
AmqpInboundGateway.replyHeadersMappedLast
; expose iton the DSL and XML level
MappingUtils.mapReplyMessage()
DefaultAmqpHeaderMapper
to not parse JSON headers at allwhen
JsonHeaders.TYPE_ID
is already present (e.g.MessageConverter
result)
JsonHeaders
when wepopulateUserDefinedHeader()
Cherry-pick to 5.1.x