[
https://issues.apache.org/jira/browse/CAMEL-27911?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27911:
--------------------------------
Description:
Found while improving the option descriptions of camel-salesforce for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/a561eb3ba0e862dd16db25f1e5346154022279a1,
pull request https://github.com/apache/camel/pull/31173).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The loginUrl default is not applied when only component options are used
{{SalesforceComponent.loginUrl}} has no initializer, although @Metadata
declares the default https://login.salesforce.com.
{{SalesforceComponent.doStart}} creates a SalesforceLoginConfig and calls
setLoginUrl(loginUrl), which replaces the default of SalesforceLoginConfig with
null, so on plain Camel or Camel Main without loginUrl the login fails with
"loginUrl must be specified" (Camel Spring Boot is not affected, as its
auto-configuration applies the default). loginUrl is also marked required while
it has a default.
Proposed change: initialize the field with
SalesforceLoginConfig.DEFAULT_LOGIN_URL.
h4. 2. httpClientProperties cannot set the Jetty timeouts
{{SalesforceComponent.setupHttpClient}} always puts httpIdleTimeout,
httpConnectionTimeout and httpRequestTimeout into the client properties (they
are primitives with defaults), after the httpClientProperties map is applied,
so idleTimeout, connectTimeout and timeout given in httpClientProperties are
replaced silently.
Proposed change: only set these when the option was changed, or document that
the HTTP options win.
h4. 3. The HTTP client is never destroyed
{{SalesforceComponent.doStop}} destroys the client only when
config.getHttpClient() is null, but doStart and createEndpoint always store the
client in the config, so destroy() is never called; after a restart of the
component the same client gets its proxy and authentication configuration added
again.
Proposed change: track whether the component created the client and destroy it
in doStop.
h4. 4. The pkChunking options are ignored
{{SalesforceEndpointConfig.toValueMap}} does not put pkChunking,
pkChunkingChunkSize, pkChunkingParent and pkChunkingStartRow into the map that
{{BulkApiProcessor.determineHeaders}} reads through getParameter, so only the
CamelSalesforcePkChunking* headers enable PK chunking. The Bulk API doc page
says it works via the options, and lists pkChunkingStartRow as Integer while it
is a String.
Proposed change: add the four values to toValueMap.
h4. 5. Bulk API batches in JSON are sent with Content-Type null
{{DefaultBulkApiClient.getContentType}} returns null for ContentType.JSON and
ZIP_JSON, so createBatch and createBatchQuery send "Content-Type:
null;charset=UTF-8".
Proposed change: map JSON to application/json and ZIP_JSON to zip/json.
h4. 6. raw operation: NullPointerException for a missing header in
rawHttpHeaders
{{RawProcessor.determineHeaders}} calls getHeader(name).toString() for each
name in rawHttpHeaders, so a missing header gives a NullPointerException, while
rawQueryParameters reports "Missing header".
Proposed change: check for null the same way as for rawQueryParameters.
h4. 7. pubSubSubscribe with POJO deserialization fails for each event without
pubSubPojoClass
{{PubSubApiConsumer}} does not check that pubSubPojoClass is set when
pubSubDeserializeType=POJO; every event then fails with a NullPointerException
in new ReflectDatumReader(null).
Proposed change: validate the option when the consumer is created.
h4. 8. Endpoint options ignored by subscribe and by the REST and raw operations
{{SubscriptionHelper}} reads backoffIncrement, maxBackoff, apiVersion (for the
CometD URL) and httpClient from the component configuration, so these endpoint
options have no effect on the subscribe consumer.
{{SalesforceComponent.createRestClientFor}} and createRawClientFor always use
the component HttpClient, so an endpoint httpClient is only used by the Bulk,
Bulk 2.0, Analytics and Composite operations. The descriptions now say so.
Proposed change: read the endpoint configuration instead.
h4. 9. Smaller issues
initialReplyIdTimeout is not read anywhere (deprecation candidate).
httpMaxContentLength and format have no defaultValue in the metadata (4194304
and JSON). pubSubHost and pubSubPort are labelled security. Most endpoint
configuration options are labelled common, although they only apply to the
producer or the consumer. The header CamelSalesforceReplayId is typed Object
but is a Long. The Bulk API doc page says to pass the whole nextRecordsUrl as
queryLocator, but Camel appends ?queryLocator=<value>, so only the locator
value works. The auth table of the doc page lists clientSecret as needed for
the refresh token flow, where it is optional.
_Claude Code on behalf of davsclaus_
was:
Found while improving the option descriptions of camel-salesforce for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31173).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. The loginUrl default is not applied when only component options are used
{{SalesforceComponent.loginUrl}} has no initializer, although @Metadata
declares the default https://login.salesforce.com.
{{SalesforceComponent.doStart}} creates a SalesforceLoginConfig and calls
setLoginUrl(loginUrl), which replaces the default of SalesforceLoginConfig with
null, so on plain Camel or Camel Main without loginUrl the login fails with
"loginUrl must be specified" (Camel Spring Boot is not affected, as its
auto-configuration applies the default). loginUrl is also marked required while
it has a default.
Proposed change: initialize the field with
SalesforceLoginConfig.DEFAULT_LOGIN_URL.
h4. 2. httpClientProperties cannot set the Jetty timeouts
{{SalesforceComponent.setupHttpClient}} always puts httpIdleTimeout,
httpConnectionTimeout and httpRequestTimeout into the client properties (they
are primitives with defaults), after the httpClientProperties map is applied,
so idleTimeout, connectTimeout and timeout given in httpClientProperties are
replaced silently.
Proposed change: only set these when the option was changed, or document that
the HTTP options win.
h4. 3. The HTTP client is never destroyed
{{SalesforceComponent.doStop}} destroys the client only when
config.getHttpClient() is null, but doStart and createEndpoint always store the
client in the config, so destroy() is never called; after a restart of the
component the same client gets its proxy and authentication configuration added
again.
Proposed change: track whether the component created the client and destroy it
in doStop.
h4. 4. The pkChunking options are ignored
{{SalesforceEndpointConfig.toValueMap}} does not put pkChunking,
pkChunkingChunkSize, pkChunkingParent and pkChunkingStartRow into the map that
{{BulkApiProcessor.determineHeaders}} reads through getParameter, so only the
CamelSalesforcePkChunking* headers enable PK chunking. The Bulk API doc page
says it works via the options, and lists pkChunkingStartRow as Integer while it
is a String.
Proposed change: add the four values to toValueMap.
h4. 5. Bulk API batches in JSON are sent with Content-Type null
{{DefaultBulkApiClient.getContentType}} returns null for ContentType.JSON and
ZIP_JSON, so createBatch and createBatchQuery send "Content-Type:
null;charset=UTF-8".
Proposed change: map JSON to application/json and ZIP_JSON to zip/json.
h4. 6. raw operation: NullPointerException for a missing header in
rawHttpHeaders
{{RawProcessor.determineHeaders}} calls getHeader(name).toString() for each
name in rawHttpHeaders, so a missing header gives a NullPointerException, while
rawQueryParameters reports "Missing header".
Proposed change: check for null the same way as for rawQueryParameters.
h4. 7. pubSubSubscribe with POJO deserialization fails for each event without
pubSubPojoClass
{{PubSubApiConsumer}} does not check that pubSubPojoClass is set when
pubSubDeserializeType=POJO; every event then fails with a NullPointerException
in new ReflectDatumReader(null).
Proposed change: validate the option when the consumer is created.
h4. 8. Endpoint options ignored by subscribe and by the REST and raw operations
{{SubscriptionHelper}} reads backoffIncrement, maxBackoff, apiVersion (for the
CometD URL) and httpClient from the component configuration, so these endpoint
options have no effect on the subscribe consumer.
{{SalesforceComponent.createRestClientFor}} and createRawClientFor always use
the component HttpClient, so an endpoint httpClient is only used by the Bulk,
Bulk 2.0, Analytics and Composite operations. The descriptions now say so.
Proposed change: read the endpoint configuration instead.
h4. 9. Smaller issues
initialReplyIdTimeout is not read anywhere (deprecation candidate).
httpMaxContentLength and format have no defaultValue in the metadata (4194304
and JSON). pubSubHost and pubSubPort are labelled security. Most endpoint
configuration options are labelled common, although they only apply to the
producer or the consumer. The header CamelSalesforceReplayId is typed Object
but is a Long. The Bulk API doc page says to pass the whole nextRecordsUrl as
queryLocator, but Camel appends ?queryLocator=<value>, so only the locator
value works. The auth table of the doc page lists clientSecret as needed for
the refresh token flow, where it is optional.
_Claude Code on behalf of davsclaus_
> camel-salesforce: loginUrl default not applied on plain Camel, pkChunking
> options ignored, Bulk API JSON batches sent with Content-Type null, endpoint
> httpClient and backoff options ignored by some operations
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27911
> URL: https://issues.apache.org/jira/browse/CAMEL-27911
> Project: Camel
> Issue Type: Bug
> Components: camel-salesforce
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-salesforce for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/a561eb3ba0e862dd16db25f1e5346154022279a1,
> pull request https://github.com/apache/camel/pull/31173).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. The loginUrl default is not applied when only component options are
> used
> {{SalesforceComponent.loginUrl}} has no initializer, although @Metadata
> declares the default https://login.salesforce.com.
> {{SalesforceComponent.doStart}} creates a SalesforceLoginConfig and calls
> setLoginUrl(loginUrl), which replaces the default of SalesforceLoginConfig
> with null, so on plain Camel or Camel Main without loginUrl the login fails
> with "loginUrl must be specified" (Camel Spring Boot is not affected, as its
> auto-configuration applies the default). loginUrl is also marked required
> while it has a default.
> Proposed change: initialize the field with
> SalesforceLoginConfig.DEFAULT_LOGIN_URL.
> h4. 2. httpClientProperties cannot set the Jetty timeouts
> {{SalesforceComponent.setupHttpClient}} always puts httpIdleTimeout,
> httpConnectionTimeout and httpRequestTimeout into the client properties (they
> are primitives with defaults), after the httpClientProperties map is applied,
> so idleTimeout, connectTimeout and timeout given in httpClientProperties are
> replaced silently.
> Proposed change: only set these when the option was changed, or document that
> the HTTP options win.
> h4. 3. The HTTP client is never destroyed
> {{SalesforceComponent.doStop}} destroys the client only when
> config.getHttpClient() is null, but doStart and createEndpoint always store
> the client in the config, so destroy() is never called; after a restart of
> the component the same client gets its proxy and authentication configuration
> added again.
> Proposed change: track whether the component created the client and destroy
> it in doStop.
> h4. 4. The pkChunking options are ignored
> {{SalesforceEndpointConfig.toValueMap}} does not put pkChunking,
> pkChunkingChunkSize, pkChunkingParent and pkChunkingStartRow into the map
> that {{BulkApiProcessor.determineHeaders}} reads through getParameter, so
> only the CamelSalesforcePkChunking* headers enable PK chunking. The Bulk API
> doc page says it works via the options, and lists pkChunkingStartRow as
> Integer while it is a String.
> Proposed change: add the four values to toValueMap.
> h4. 5. Bulk API batches in JSON are sent with Content-Type null
> {{DefaultBulkApiClient.getContentType}} returns null for ContentType.JSON and
> ZIP_JSON, so createBatch and createBatchQuery send "Content-Type:
> null;charset=UTF-8".
> Proposed change: map JSON to application/json and ZIP_JSON to zip/json.
> h4. 6. raw operation: NullPointerException for a missing header in
> rawHttpHeaders
> {{RawProcessor.determineHeaders}} calls getHeader(name).toString() for each
> name in rawHttpHeaders, so a missing header gives a NullPointerException,
> while rawQueryParameters reports "Missing header".
> Proposed change: check for null the same way as for rawQueryParameters.
> h4. 7. pubSubSubscribe with POJO deserialization fails for each event without
> pubSubPojoClass
> {{PubSubApiConsumer}} does not check that pubSubPojoClass is set when
> pubSubDeserializeType=POJO; every event then fails with a
> NullPointerException in new ReflectDatumReader(null).
> Proposed change: validate the option when the consumer is created.
> h4. 8. Endpoint options ignored by subscribe and by the REST and raw
> operations
> {{SubscriptionHelper}} reads backoffIncrement, maxBackoff, apiVersion (for
> the CometD URL) and httpClient from the component configuration, so these
> endpoint options have no effect on the subscribe consumer.
> {{SalesforceComponent.createRestClientFor}} and createRawClientFor always use
> the component HttpClient, so an endpoint httpClient is only used by the Bulk,
> Bulk 2.0, Analytics and Composite operations. The descriptions now say so.
> Proposed change: read the endpoint configuration instead.
> h4. 9. Smaller issues
> initialReplyIdTimeout is not read anywhere (deprecation candidate).
> httpMaxContentLength and format have no defaultValue in the metadata (4194304
> and JSON). pubSubHost and pubSubPort are labelled security. Most endpoint
> configuration options are labelled common, although they only apply to the
> producer or the consumer. The header CamelSalesforceReplayId is typed Object
> but is a Long. The Bulk API doc page says to pass the whole nextRecordsUrl as
> queryLocator, but Camel appends ?queryLocator=<value>, so only the locator
> value works. The auth table of the doc page lists clientSecret as needed for
> the refresh token flow, where it is optional.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)