Andrea Cosentino created CAMEL-23409:
----------------------------------------

             Summary: camel-sjms - Disable ObjectMessage by default
                 Key: CAMEL-23409
                 URL: https://issues.apache.org/jira/browse/CAMEL-23409
             Project: Camel
          Issue Type: Improvement
          Components: camel-sjms
            Reporter: Andrea Cosentino


camel-sjms currently always processes JMS ObjectMessage instances on the 
consumer side and creates them on the producer side when a Serializable body is 
sent or when transferException=true is set.

For consistency with camel-jms (CAMEL-23373, which introduced the 
objectMessageEnabled option in 4.21 and disabled ObjectMessage support by 
default), the same option should be added to camel-sjms (and inherited by 
camel-sjms2 via Sjms2Endpoint extends SjmsEndpoint).

h3. Proposed change

Add a new endpoint/component option {{objectMessageEnabled}} (default 
{{false}}) to:

* {{SjmsEndpoint}} -- {{@UriParam(label = "advanced", defaultValue = "false")}}
* {{SjmsComponent}} -- corresponding {{@Metadata}} for the component-level 
default

When {{objectMessageEnabled=false}} (the new default), {{JmsBinding}} should 
refuse to:

* extract the body of a received {{jakarta.jms.ObjectMessage}}
* create an {{ObjectMessage}} from a {{Serializable}} body (auto-detected 
{{JmsMessageType=Object}} or explicitly set)
* create an {{ObjectMessage}} for {{transferException}}

To restore the previous behaviour, set {{objectMessageEnabled=true}} on the 
component or endpoint.

h3. Affected files (camel-sjms)

* {{org.apache.camel.component.sjms.SjmsComponent}}
* {{org.apache.camel.component.sjms.SjmsEndpoint}}
* {{org.apache.camel.component.sjms.jms.JmsBinding}}

camel-sjms2 inherits the change via {{Sjms2Endpoint extends SjmsEndpoint}}; no 
further code changes are expected there.

h3. Documentation

Extend the 4.21 upgrade guide entry for CAMEL-23373 
({{docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc}}) to 
mention that the same default applies to camel-sjms / camel-sjms2.

h3. Tests

Add a unit test in camel-sjms equivalent to {{JmsObjectMessageEnabledTest}} in 
camel-jms to verify default-disabled behaviour on producer and consumer paths, 
and that {{objectMessageEnabled=true}} re-enables them.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to