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
JmsOutboundGateway overwrites existing jms_correlationId [INT-3405] #7376
Comments
Gary Russell commented Given that the gateway is responsible for message correlation, it can't rely on the user-provided correlation id, for several reasons... The framework cannot guarantee the id is unique. Consider the flow So, the current behavior is for safety; we can consider adding a configuration option allowing the use of the existing correlation id if present, but it will be the application's responsibility to avoid the above problems. In the meantime, perhaps you can copy your correlation Id to a different header and it will be transported as a JMS property. |
Manuel Polacek commented Gary, If you're interested in, i could prepare a pull request... |
Gary Russell commented Thanks for your interest in contributing. Please be sure to "sign" the CLA as discussed in CONTRIBUTING.md. We generally don't allow XML schema changes in point releases (e.g. 4.0.1), that's why I scheduled this for 4.1. We can make the change to the gateway in 4.0.x, but the schema can't change, so the gateway would have to be wired up as a Alternatively, perhaps we can come up with a "special" value for Perhaps Artem Bilan has another suggestion. |
Artem Bilan commented For me Can be done for current release. |
Gary Russell commented Merged |
Igor Petrov commented Excuse me for by humble opinion, but shouldn't there be a way to leave correlation id untouched at all? In ongoing implementation if I utilize OutboundGateway with custom correlationId defined, there is still no way resulting jmsCorrelationId is not the same or null (JmsOutboundGateway#doSendAndReceiveWithGeneratedCorrelationId). Imagine there is a code: @MessagingGateway
public interface BookingGateway<T, R> {
@Gateway(requestChannel = "bookingChannel")
ListenableFuture<R> bookTicket(T ticket,
@Header(IntegrationMessageHeaderAccessor.CORRELATION_ID) String correlationId,
@Header(MessageHeaders.REPLY_CHANNEL) String replyTo);
} |
Gary Russell commented I think you misunderstand; you need to set the Second, you should NOT be setting If you are trying to set the |
Igor Petrov commented Thanks for reply, Gary. I got it, I just wrote my message out of context. In case above I utilize OutgoingGateway in order to gain request-reply behavior. There is a system that consists of three separate applications. First is a "producer", second can be called a "middle-tier" and finally "consumer" as a final destination (server).
As you can see through 2nd to 6th steps - it's a Smart Proxy out there. |
Gary Russell commented
But we don't overwrite that header, JMS uses a different one. Something else must be dropping/changing the I suggest you turn on DEBUG logging and follow the message flow. There's no reason you shouldn't be able to get back the right correlation id. |
Manuel Polacek opened INT-3405 and commented
We have the requirement to use a consistent correlation id for a request through all our components. This works well until we try to use JmsOutboundGateway. With correlation-key set to "JMSCorrelationID" the gateway will create a new random correlation id instead of using the value of the existing header jms_correlationId (JmsHeaders.CORRELATION_ID).
Suggested fix: Check if header jms_correlationId exists and use it if set. If not set revert to the current behavior.
Affects: 3.0.2, 4.0 GA
Referenced from: pull request #1162
1 votes, 5 watchers
The text was updated successfully, but these errors were encountered: