Repository navigation
Jakarta 3.1 proper JMSX provider properties handling - #2864
Conversation
…a foreign message On a strict connection, sending a message from another provider failed with MessageNotWriteableException when that message listed a property such as JMSXDeliveryCount. The conversion now leaves those properties out on a strict connection. transformMessage and copyProperties have an overload that takes a strictComplianceOverride flag. True copies the provider-set values even on a strict connection, for example when bridging. The consumer passes true for a message returned by a consumer transformer, since that message is on its way to the application. The set of property names is renamed to JMSX_PROVIDER_PROPERTIES.
Yes. This is specifically for handling the conversion of a foreign JMS message by the consumer or when a message transformer is specified for message conversion. When a foreign JMS message is received, or a consumer transformer the provider specific properties need to be set on the newly constructed ActiveMQMessage. |
There was a problem hiding this comment.
LLM found 2 issues to look at:
1. [P2] Consumer transformers lose provider-set properties in strict mode
Location:
ActiveMQMessageTransformation.java:199–217
The existing two-argument copyProperties() now skips provider-set properties whenever the target message belongs to a strict connection. This also affects consumer transformers using MessageTransformerSupport.copyProperties() to copy a received message into session.createTextMessage().
The override in ActiveMQMessageConsumer runs after the transformer, so it cannot recover the discarded properties. Native
ActiveMQMessage results also return directly from transformMessage().
Reproduced with an embedded broker:
- After two
session.recover()calls, the transformer receivesJMSXDeliveryCount=3, but the application receives 2. - The transformer receives
JMSXAppID="provider-app", but the application receives null. - Lenient mode preserves both values.
This loses provider metadata and corrupts delivery-attempt tracking.
Suggested fix: distinguish outbound conversion from inbound transformer copying. Preserve provider-set values on the consumer path, and add a regression using a transformer that copies into a session-created native message.
2. [P2] JMSProducer restrictions depend on the message implementation
Location:
ActiveMQMessage.java:531–536
The new check only executes on an ActiveMQ message setter. On a strict JMSContext, the following behavior is reproducible:
producer.setProperty("JMSXAppID", "app-set-value")succeeds.- Sending a native message created by
context.createMessage()throwsJMSRuntimeException. - Sending a foreign message succeeds, but
JMSXAppIDis silently discarded during conversion.
For the foreign message, the producer applies the property through that provider’s setter before ActiveMQ conversion removes it. The same strict producer configuration therefore fails for native messages but succeeds for foreign messages.
Suggested fix: validate provider-only names at the strict JMSProducer.setProperty() boundary. Add coverage for both native and foreign sends while retaining lenient behavior.
|
And here is a commit with the suggestions implemented to look at cshannon@ecbec08 |
This PR is ready and slides the behavior behind the strictCompliance flag.
Background
Provider-specific JMSX properties should not be allowed to be set by application code. ActiveMQ previously allowed this, so throwing an exception would be a SEMVER violation without a major version update.
This changes allows ActiveMQ to become more Jakarta compliant in a minor release, while also retaining the ability to perform an administrative copy at times that includes thos values. For example, a bridge or migration may want to copy those headers across from one JMS system to another.
Related
replaces [#1853]