Andrea Cosentino created CAMEL-23716:
----------------------------------------
Summary: camel-salesforce - align Exchange header constant names
with Camel naming convention
Key: CAMEL-23716
URL: https://issues.apache.org/jira/browse/CAMEL-23716
Project: Camel
Issue Type: Improvement
Components: camel-salesforce
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.21.0
The Salesforce header constants in
{{org.apache.camel.component.salesforce.SalesforceEndpointConfig}} use
camelCase string values that do not follow the Camel naming convention, and the
camel-salesforce module ships no component-specific HeaderFilterStrategy. As a
result these names fall outside the {{CAMEL_FILTER_STARTS_WITH = {"Camel",
"camel"}}} set used by the standard HeaderFilterStrategy implementations, so
they are not stripped by the default Camel / HTTP header filtering when an
exchange flows between transports.
{{AbstractSalesforceProcessor.getParameter()}} resolves an incoming header
ahead of the endpoint configuration, so a header present on the exchange
supersedes the route-time URI parameter.
The most commonly-set constants drive the REST query / search / Apex dispatch:
* {{SOBJECT_QUERY = "sObjectQuery"}} - SOQL query passed to
{{restClient.query()}} / {{queryAll()}}
* {{SOBJECT_SEARCH = "sObjectSearch"}} - SOSL search passed to
{{restClient.search()}}
* {{SOBJECT_NAME = "sObjectName"}} / {{SOBJECT_ID = "sObjectId"}} - target
object / record for CRUD
* {{APEX_URL = "apexUrl"}} / {{APEX_METHOD = "apexMethod"}} - Apex REST
endpoint + HTTP method passed to {{restClient.apexCall()}}
* {{APEX_QUERY_PARAM_PREFIX = "apexQueryParam."}} - prefix collected into the
Apex call query parameters
The same applies to the remaining string-value constants in
{{SalesforceEndpointConfig}} (sObjectIds, sObjectFields, sObjectIdName,
sObjectIdValue, sObjectBlobFieldName, sObjectClass, streamQueryResult,
compositeMethod, limit, allOrNone, eventName, eventSchemaId, eventSchemaFormat,
contentType, jobId, batchId, resultId, queryLocator, locator, maxRecords,
pkChunking*, reportId, includeDetails, reportMetadata, instanceId,
defaultReplayId, fallBackReplayId, initialReplayIdMap, replayPreset,
pubSubDeserializeType, pubSubPojoClass, approval, rawPath, rawMethod,
rawQueryParameters, rawHttpHeaders, notFoundBehaviour, apiVersion, format,
rawPayload).
Rename to {{CamelSalesforce<Name>}} (and {{CamelSalesforceApexQueryParam.}} for
the prefix constant) across all constants.
h3. Fix shape
Rename the *string value* of each producer-read header constant to
{{Camel<Component><Name>}}; keep the Java field name unchanged so routes that
reference the constants symbolically continue to compile and run. Update tests
that use the literal string values; regenerate component catalog JSON and docs;
add an upgrade-guide entry in {{camel-4x-upgrade-guide-4_21.adoc}} marked as a
potential breaking change (and matching 4_18 / 4_14 for backports - the
component exists on both maintenance branches).
h3. References
* Tracker: CAMEL-23577
* Precedent (rename pattern): CAMEL-23526 (camel-cxf)
* Alternative pattern (HeaderFilterStrategy approach): CAMEL-23532
(camel-vertx-websocket / camel-atmosphere-websocket / camel-iggy)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)