-
Notifications
You must be signed in to change notification settings - Fork 626
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
Set replyPostProcessor default value from the message container factory #1425
Comments
Agreed.
where the mentioned Feel free to come back to us with a contribution: https://github.com/spring-projects/spring-amqp/blob/main/CONTRIBUTING.adoc Thank you! |
It's actually this code that sets the RPP... Lines 124 to 125 in a3aedc6
Not the In the meantime, you can use this... @Bean
public ReplyPostProcessor echoCustomHeader(AbstractRabbitListenerContainerFactory<?> factory) {
ReplyPostProcessor rpp = (req, resp) -> {
resp.getMessageProperties().setHeader("myHeader", req.getMessageProperties().getHeader("myHeader"));
return resp;
};
factory.setContainerCustomizer(container -> {
MessagingMessageListenerAdapter listener = ((MessagingMessageListenerAdapter) container
.getMessageListener());
listener.setReplyPostProcessor(rpp);
});
return rpp;
} |
Yes, but it also could be done by the |
Expected Behavior
Use default value (bean name or class) for
@RabbitListener
annotation's attributereplyPostProcessor
using message container factory like we do forAfterReceivePostProcessors
andBeforeSendReplyPostProcessors
.Current Behavior
We can set
replyPostProcessor
value only from@RabbitListener
annotation.Example :
Context
Currently we need to add a custom header (that we get from inbound request) to our responses, and we can't do that using
AfterReceivePostProcessors
orBeforeSendReplyPostProcessors
becauseMessagePostProcessor.postProcessMessage
give only the current message as parameter.The best solution for this probleme is to use
replyPostProcessor
, but we can't change all@RabbitListener
annotations to add this attribute.That's why I suggest to add new method to the container factory to make changing default
replyPostProcessor
value possible. (like forsetAfterReceivePostProcessors
andsetBeforeSendReplyPostProcessors
)The text was updated successfully, but these errors were encountered: