jakartaee / jakartaee/messaging
Sending a foreign message using a provider which does not support setJMSCorrelationIDAsBytes
- Dominant language
- Java
- Stars
- 49
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
It is optional whether a JMS provider supports the method setJMSCorrelationIDAsBytes on Message. This method is permitted to throw a java.lang.UnsupportedOperationException if the provider does not support this feature.
However there is an obscure case (which applies equally to JMS 1.1 and JMS 2.0) where the allowed behaviour is not specified. This is when a JMS provider is being used to send a message whose implementation is not its own (which JMS says must be allowed).
Imagine an application that receives a message from a JMS provider which supports native correlation ID values, and then sends the same message to a JMS provider which does not support them.
```
// receive message from JMS provider which supports native correlation ID values
MessageConsumer consumer = ....
Message message = consumer.receive();
// now call setJMSCorrelationIDAsBytes on the received message
// this will work as the provider supports native correlation ID values
message.setJMSCorrelationIDAsBytes(bytes);
// now send this message using a JMS provider which does NOT support native correlation ID values
// should this throw a UnsupportedOperationException?
MessageProducer producer = ...
producer.send(message);
```
There are two options here. Since the second JMS provider does not support native correlation ID values it must either throw a UnsupportedOperationException or simply ignore the value that was set.
The spec should be clarified to define the allowed behaviour.
#### Affected Versions
[2.0]
Contributor guide
Research direction
Start by reviewing the JMS 1.1 and 2.0 specification rules for setJMSCorrelationIDAsBytes and sending a foreign Message. Determine whether the receiving provider must throw UnsupportedOperationException or ignore the value, then clarify the specification so this case has one defined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100