Dhairya-007 opened a new pull request, #30039:
URL: https://github.com/apache/camel/pull/30039
## Problem
`JMSReplyTo` is documented with a single Java type:
```java
@Metadata(description = "The JMS reply-to destination.", javaType =
"jakarta.jms.Destination")
public static final String JMS_HEADER_REPLY_TO = "JMSReplyTo";
```
A `jakarta.jms.Destination` is what the header carries *inbound* -
`JmsBinding` puts one there when it maps a JMS message onto the exchange:
```java
map.put(JmsConstants.JMS_HEADER_REPLY_TO,
JmsMessageHelper.getJMSReplyTo(jmsMessage));
```
But on the way out, a `String` is first-class, and is in fact the only form
the producer looks for:
```java
// prefer reply to from header over endpoint configured
jmsReplyTo = exchange.getIn().getHeader(JmsConstants.JMS_HEADER_REPLY_TO,
String.class);
if (jmsReplyTo == null) {
jmsReplyTo = endpoint.getReplyTo();
}
```
`JmsBinding.appendJmsProperty` handles the `String` case explicitly, because
a bare name is not what a provider will convert:
```java
} else if (headerName.equalsIgnoreCase(JmsConstants.JMS_HEADER_REPLY_TO) &&
headerValue != null) {
if (headerValue instanceof String string) {
// if the value is a String we must normalize it first, and must
include the prefix
// as ActiveMQ requires that when converting the String to a
jakarta.jms.Destination type
headerValue = normalizeDestinationName(string, true);
}
Destination replyTo = ExchangeHelper.convertToType(exchange,
Destination.class, headerValue);
```
So a route that sets `JMSReplyTo` to a destination *name* - the obvious and
documented-elsewhere way to do it, and the only form `JmsProducer` reads - is
doing something the catalog says is the wrong type, while the type the catalog
does advertise is not the one the producer reads.
## Fix
Document both forms, the way other Camel headers that accept an object or
its name do (`javaType = "... or String"`), and say in the description which
direction each applies to. No behaviour change.
The regenerated `jms.json` is included; `camel-activemq`, `camel-activemq6`
and `camel-amqp` mirror `JmsConstants`, so their generated files and the four
catalog copies carry the same entry.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]