Skip to content

Enforce provider-only JMSX properties under strictCompliance - #1853

Closed
pradeep85841 wants to merge 5 commits into
apache:mainfrom
pradeep85841:strict-compliance-provider-jmsx
Closed

pradeep85841 wants to merge 5 commits into
apache:mainfrom
pradeep85841:strict-compliance-provider-jmsx

Conversation

@pradeep85841

Copy link
Copy Markdown
Contributor
  • Throws a MessageNotWriteableException if a client attempts to set JMSXDeliveryCount, JMSXRcvTimestamp, JMSXState, JMSXProducerTXID, or JMSXConsumerTXID.
  • Client-set properties (like JMSXGroupID and JMSXGroupSeq) are completely bypassed and function normally.
  • Added StrictComplianceProviderJMSXPropertyTest using an embedded BrokerService to explicitly verify both strict and legacy behaviors.

@pradeep85841

Copy link
Copy Markdown
Contributor Author

Hi @jbonofre, just a quick ping on this! The changes are pushed with JMSException and the corrected imports. Let me know if anything else is needed

@pradeep85841
pradeep85841 requested a review from jbonofre April 1, 2026 16:58
@jbonofre

jbonofre commented Apr 1, 2026

Copy link
Copy Markdown
Member

@pradeep85841 thanks ! Let me do a new pass.

@pradeep85841

Copy link
Copy Markdown
Contributor Author

Updated the "Wait.waitFor" condition in "testNetworkAdvancedStatistics". The test now waits for the broker to finish updating its background metrics (like enqueues and dequeues) before doing the final checks.

@pradeep85841

Copy link
Copy Markdown
Contributor Author

​Hi @jbonofre , just checking in! Both the main PR updates (exception/imports) and the fix for the flaky CI test are pushed. Let me know if you can kick off the CI checks again!

// Strict Compliance Check For Provider-Set JMSX Properties
ActiveMQConnection conn = getConnection();
if (conn != null && conn.isStrictCompliance()) {
if ("JMSXDeliveryCount".equals(name) ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a constant final public static set would make more sense here vs each property listed out by string name.

@mattrpav

Copy link
Copy Markdown
Contributor

Is the network metrics fix commit already merged? That should probably be a separate PR that can be merged quickly

@mattrpav
mattrpav self-requested a review April 22, 2026 16:01
@pradeep85841

pradeep85841 commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @mattrpav, I've split the flaky network metrics test fix into its own PR here: #1960
And updated this branch to use a public static final Set for the property checks as you suggested.

import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.*;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't reduce imports to wildcard. It is a common IDE setting, but we don't have the code style rules applied to catch it.

@pradeep85841

Copy link
Copy Markdown
Contributor Author

@mattrpav, My IDE auto-collapsed them when I added the Set classes. I've expanded them back to explicit imports and updated my local settings so it won't happen again. The fix is pushed

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions Bot added the Stale label Sep 10, 2026
@github-actions github-actions Bot closed this Sep 17, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Apache ActiveMQ v6.5.0 Sep 17, 2026
@mattrpav mattrpav removed the Stale label Sep 21, 2026
@mattrpav mattrpav added this to the Jakarta 3.1/JMS 2.0 support milestone Sep 21, 2026
@mattrpav mattrpav reopened this Sep 21, 2026
ActiveMQConnection conn = getConnection();
if (conn != null && conn.isStrictCompliance()) {
if (STRICT_PROVIDER_JMSX_PROPERTIES.contains(name)) {
throw new JMSException("Provider-set JMSX property '" + name + "' cannot be set by a client under strict compliance.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update this exception to throw MessageNotWriteableException to be spec-aligned.

@pradeep85841

Copy link
Copy Markdown
Contributor Author

Hi @mattrpav, I've updated the exception to MessageNotWriteableException.

@mattrpav

Copy link
Copy Markdown
Contributor

Replaced by [#2864] with @pradeep85841's commits retained

@mattrpav mattrpav closed this Nov 13, 2026
mattrpav added a commit that referenced this pull request Nov 22, 2026
* Enforce provider-only JMSX properties under strictCompliance
* Address review feedback: Use JMSException and fix imports
* Refactor JMSX property check to use static final Set
* Expand wildcard java.util imports
* Changed exception to MessageNotWriteableException

* [#1853] Leave provider-set JMSX properties out when converting 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.

* Review feedback: Add JMSXAppID and JMSXUserID as provider-only properties
* Review feedback: JMSException when app attempts to set provider set JMSX property
* Suggested fixes from LLM

---------

Co-authored-by: pradeep85841 <pradeep.kunchala15@gmail.com>
Co-authored-by: Christopher L. Shannon <cshannon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants