This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 2064418 CAMEL-15757: Regen 2064418 is described below commit 20644182163f55efbaf28e015a6a0aa0e3278dea Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Dec 9 18:11:10 2020 +0100 CAMEL-15757: Regen --- .../camel/catalog/docs/salesforce-component.adoc | 37 +++++++-- .../camel/component/salesforce/salesforce.json | 8 +- .../src/main/docs/salesforce-component.adoc | 8 +- .../dsl/SalesforceComponentBuilderFactory.java | 50 ++++++------ .../dsl/SalesforceEndpointBuilderFactory.java | 91 ++++++---------------- .../modules/ROOT/pages/salesforce-component.adoc | 37 +++++++-- 6 files changed, 120 insertions(+), 111 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/salesforce-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/salesforce-component.adoc index 7d048fe..1dff3b6 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/salesforce-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/salesforce-component.adoc @@ -155,7 +155,7 @@ results) using result link returned from the 'query' API * recent - fetching recent items * approval - submit a record or records (batch) for approval process * approvals - fetch a list of all approval processes -* composite - submit up to 25 possibly related REST requests and receive individual responses +* composite - submit up to 25 possibly related REST requests and receive individual responses. It's also possible to use "raw" composite without limitation. * composite-tree - create up to 200 records with parent-child relationships (up to 5 levels) in one go * composite-batch - submit a composition of requests in batch * queryAll - Runs a SOQL query. It returns the results that are deleted because of a merge or delete. Also returns the information about archived Task and Event records. @@ -602,6 +602,33 @@ final Map<String, ?> accountUpdateBody = accountUpdateResult.getBody(); final SObjectCompositeResult contactCreationResult = results.stream().filter(r -> "JunctionRecord".equals(r.getReferenceId())).findFirst().get() ---- +== Using "raw" Salesforce composite + +It's possible to directly call Salesforce composite by preparing the Salesforce JSON request in the route thanks to the `rawPayload` option. + +For instance, you can have the following route: + +---- +from("timer:fire?period=2000").setBody(constant("{\n" + + " \"allOrNone\" : true,\n" + + " \"records\" : [ { \n" + + " \"attributes\" : {\"type\" : \"FOO\"},\n" + + " \"Name\" : \"123456789\",\n" + + " \"FOO\" : \"XXXX\",\n" + + " \"ACCOUNT\" : 2100.0\n" + + " \"ExternalID\" : \"EXTERNAL\"\n" + " }]\n" + + "}") + .to("salesforce:composite?rawPayload=true&sObjectName=FOO&sObjectIdName=EXTERNAL&compositeMethod=PATCH") + .log("${body}"); +---- + +The route directly creates the body as JSON and directly submit to salesforce endpoint using `rawPayload=true` option. + +With this approach, you have the complete control on the Salesforce request. + +The `compositeMethod` option allows you to define the Salesforce client method style (PATCH, PUT, POST, ...). + == Sending null values to salesforce By default, SObject fields with null values are not sent to salesforce. In order to @@ -665,11 +692,9 @@ The Salesforce component supports 74 options, which are listed below. | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -711,6 +736,8 @@ The Salesforce component supports 74 options, which are listed below. | *httpClientProperties* (common) | Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options. | | Map | *longPollingTransportProperties* (common) | Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api | | Map | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *httpProxyExcludedAddresses* (proxy) | A list of addresses for which HTTP proxy server should not be used. | | Set @@ -777,11 +804,9 @@ with the following path and query parameters: | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -818,6 +843,8 @@ with the following path and query parameters: | *replayId* (consumer) | The replayId value to use when subscribing | | Long | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |=== diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 0374e20..1a24f04 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -25,11 +25,9 @@ "componentProperties": { "apexMethod": { "kind": "property", "displayName": "Apex Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method name" }, "apexQueryParams": { "kind": "property", "displayName": "Apex Query Params", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Query params for APEX method" }, - "apexUrl": { "kind": "property", "displayName": "Apex Url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method URL" }, "apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "50.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, "backoffIncrement": { "kind": "property", "displayName": "Backoff Increment", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto- [...] "batchId": { "kind": "property", "displayName": "Batch Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Bulk API Batch ID" }, - "compositeMethod": { "kind": "property", "displayName": "Composite Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Composite (raw) method." }, "contentType": { "kind": "property", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.api.dto.bulk.ContentType", "enum": [ "XML", "CSV", "JSON", "ZIP_XML", "ZIP_CSV", "ZIP_JSON" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Bulk API co [...] "defaultReplayId": { "kind": "property", "displayName": "Default Replay Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "-1", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Default replayId setting if no value is found in initialReplayIdMap" }, "format": { "kind": "property", "displayName": "Format", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.PayloadFormat", "enum": [ "JSON", "XML" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Payload format to use for Salesforce API calls, either JSON or XM [...] @@ -71,6 +69,8 @@ "httpClientProperties": { "kind": "property", "displayName": "Http Client Properties", "group": "common (advanced)", "label": "common,advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all ava [...] "longPollingTransportProperties": { "kind": "property", "displayName": "Long Polling Transport Properties", "group": "common (advanced)", "label": "common,advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "description": "Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api" }, "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...] + "apexUrl": { "kind": "property", "displayName": "Apex Url", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method URL" }, + "compositeMethod": { "kind": "property", "displayName": "Composite Method", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Composite (raw) method." }, "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] "httpProxyExcludedAddresses": { "kind": "property", "displayName": "Http Proxy Excluded Addresses", "group": "proxy", "label": "common,proxy", "required": false, "type": "object", "javaType": "java.util.Set<java.lang.String>", "deprecated": false, "autowired": false, "secret": false, "description": "A list of addresses for which HTTP proxy server should not be used." }, @@ -103,11 +103,9 @@ "topicName": { "kind": "path", "displayName": "Topic Name", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The name of the topic\/channel to use" }, "apexMethod": { "kind": "parameter", "displayName": "Apex Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "APEX method name" }, "apexQueryParams": { "kind": "parameter", "displayName": "Apex Query Params", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Query params for APEX method" }, - "apexUrl": { "kind": "parameter", "displayName": "Apex Url", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "APEX method URL" }, "apiVersion": { "kind": "parameter", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "50.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Salesforce API version." }, "backoffIncrement": { "kind": "parameter", "displayName": "Backoff Increment", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Backoff interval increment for Streaming connection restart attempts for failures beyond Come [...] "batchId": { "kind": "parameter", "displayName": "Batch Id", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Bulk API Batch ID" }, - "compositeMethod": { "kind": "parameter", "displayName": "Composite Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Composite (raw) method." }, "contentType": { "kind": "parameter", "displayName": "Content Type", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.api.dto.bulk.ContentType", "enum": [ "XML", "CSV", "JSON", "ZIP_XML", "ZIP_CSV", "ZIP_JSON" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Bul [...] "defaultReplayId": { "kind": "parameter", "displayName": "Default Replay Id", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "-1", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Default replayId setting if no value is found in initialReplayIdMap" }, "format": { "kind": "parameter", "displayName": "Format", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.PayloadFormat", "enum": [ "JSON", "XML" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Payload format to use for Salesforce API calls, either JS [...] @@ -144,6 +142,8 @@ "replayId": { "kind": "parameter", "displayName": "Replay Id", "group": "consumer", "label": "consumer", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "description": "The replayId value to use when subscribing" }, "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...] "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, + "apexUrl": { "kind": "parameter", "displayName": "Apex Url", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "APEX method URL" }, + "compositeMethod": { "kind": "parameter", "displayName": "Composite Method", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Composite (raw) method." }, "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] "synchronous": { "kind": "parameter", "displayName": "Synchronous", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported)." } } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 05e92bb..1dff3b6 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -692,11 +692,9 @@ The Salesforce component supports 74 options, which are listed below. | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -738,6 +736,8 @@ The Salesforce component supports 74 options, which are listed below. | *httpClientProperties* (common) | Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options. | | Map | *longPollingTransportProperties* (common) | Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api | | Map | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *httpProxyExcludedAddresses* (proxy) | A list of addresses for which HTTP proxy server should not be used. | | Set @@ -804,11 +804,9 @@ with the following path and query parameters: | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -845,6 +843,8 @@ with the following path and query parameters: | *replayId* (consumer) | The replayId value to use when subscribing | | Long | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |=== diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SalesforceComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SalesforceComponentBuilderFactory.java index 218e4f0..a54c404 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SalesforceComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SalesforceComponentBuilderFactory.java @@ -74,17 +74,6 @@ public interface SalesforceComponentBuilderFactory { return this; } /** - * APEX method URL. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceComponentBuilder apexUrl(java.lang.String apexUrl) { - doSetProperty("apexUrl", apexUrl); - return this; - } - /** * Salesforce API version. * * The option is a: <code>java.lang.String</code> type. @@ -123,18 +112,6 @@ public interface SalesforceComponentBuilderFactory { return this; } /** - * Composite (raw) method. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceComponentBuilder compositeMethod( - java.lang.String compositeMethod) { - doSetProperty("compositeMethod", compositeMethod); - return this; - } - /** * Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. * * The option is a: @@ -670,6 +647,29 @@ public interface SalesforceComponentBuilderFactory { return this; } /** + * APEX method URL. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default SalesforceComponentBuilder apexUrl(java.lang.String apexUrl) { + doSetProperty("apexUrl", apexUrl); + return this; + } + /** + * Composite (raw) method. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default SalesforceComponentBuilder compositeMethod( + java.lang.String compositeMethod) { + doSetProperty("compositeMethod", compositeMethod); + return this; + } + /** * Whether the producer should be started lazy (on the first message). * By starting lazy you can use this to allow CamelContext and routes to * startup in situations where a producer may otherwise fail during @@ -1063,11 +1063,9 @@ public interface SalesforceComponentBuilderFactory { switch (name) { case "apexMethod": getOrCreateConfiguration((SalesforceComponent) component).setApexMethod((java.lang.String) value); return true; case "apexQueryParams": getOrCreateConfiguration((SalesforceComponent) component).setApexQueryParams((java.util.Map) value); return true; - case "apexUrl": getOrCreateConfiguration((SalesforceComponent) component).setApexUrl((java.lang.String) value); return true; case "apiVersion": getOrCreateConfiguration((SalesforceComponent) component).setApiVersion((java.lang.String) value); return true; case "backoffIncrement": getOrCreateConfiguration((SalesforceComponent) component).setBackoffIncrement((long) value); return true; case "batchId": getOrCreateConfiguration((SalesforceComponent) component).setBatchId((java.lang.String) value); return true; - case "compositeMethod": getOrCreateConfiguration((SalesforceComponent) component).setCompositeMethod((java.lang.String) value); return true; case "contentType": getOrCreateConfiguration((SalesforceComponent) component).setContentType((org.apache.camel.component.salesforce.api.dto.bulk.ContentType) value); return true; case "defaultReplayId": getOrCreateConfiguration((SalesforceComponent) component).setDefaultReplayId((java.lang.Long) value); return true; case "format": getOrCreateConfiguration((SalesforceComponent) component).setFormat((org.apache.camel.component.salesforce.internal.PayloadFormat) value); return true; @@ -1109,6 +1107,8 @@ public interface SalesforceComponentBuilderFactory { case "httpClientProperties": ((SalesforceComponent) component).setHttpClientProperties((java.util.Map) value); return true; case "longPollingTransportProperties": ((SalesforceComponent) component).setLongPollingTransportProperties((java.util.Map) value); return true; case "bridgeErrorHandler": ((SalesforceComponent) component).setBridgeErrorHandler((boolean) value); return true; + case "apexUrl": getOrCreateConfiguration((SalesforceComponent) component).setApexUrl((java.lang.String) value); return true; + case "compositeMethod": getOrCreateConfiguration((SalesforceComponent) component).setCompositeMethod((java.lang.String) value); return true; case "lazyStartProducer": ((SalesforceComponent) component).setLazyStartProducer((boolean) value); return true; case "autowiredEnabled": ((SalesforceComponent) component).setAutowiredEnabled((boolean) value); return true; case "httpProxyExcludedAddresses": ((SalesforceComponent) component).setHttpProxyExcludedAddresses((java.util.Set) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java index 4921261..08e6bb5 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java @@ -81,17 +81,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * APEX method URL. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointConsumerBuilder apexUrl(String apexUrl) { - doSetProperty("apexUrl", apexUrl); - return this; - } - /** * Salesforce API version. * * The option is a: <code>java.lang.String</code> type. @@ -143,18 +132,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * Composite (raw) method. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointConsumerBuilder compositeMethod( - String compositeMethod) { - doSetProperty("compositeMethod", compositeMethod); - return this; - } - /** * Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. * * The option is a: @@ -1014,17 +991,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * APEX method URL. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointProducerBuilder apexUrl(String apexUrl) { - doSetProperty("apexUrl", apexUrl); - return this; - } - /** * Salesforce API version. * * The option is a: <code>java.lang.String</code> type. @@ -1076,18 +1042,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * Composite (raw) method. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointProducerBuilder compositeMethod( - String compositeMethod) { - doSetProperty("compositeMethod", compositeMethod); - return this; - } - /** * Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. * * The option is a: @@ -1742,6 +1696,29 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** + * APEX method URL. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default SalesforceEndpointProducerBuilder apexUrl(String apexUrl) { + doSetProperty("apexUrl", apexUrl); + return this; + } + /** + * Composite (raw) method. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default SalesforceEndpointProducerBuilder compositeMethod( + String compositeMethod) { + doSetProperty("compositeMethod", compositeMethod); + return this; + } + /** * Whether the producer should be started lazy (on the first message). * By starting lazy you can use this to allow CamelContext and routes to * startup in situations where a producer may otherwise fail during @@ -1872,17 +1849,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * APEX method URL. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointBuilder apexUrl(String apexUrl) { - doSetProperty("apexUrl", apexUrl); - return this; - } - /** * Salesforce API version. * * The option is a: <code>java.lang.String</code> type. @@ -1933,17 +1899,6 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** - * Composite (raw) method. - * - * The option is a: <code>java.lang.String</code> type. - * - * Group: common - */ - default SalesforceEndpointBuilder compositeMethod(String compositeMethod) { - doSetProperty("compositeMethod", compositeMethod); - return this; - } - /** * Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. * * The option is a: diff --git a/docs/components/modules/ROOT/pages/salesforce-component.adoc b/docs/components/modules/ROOT/pages/salesforce-component.adoc index f93a840..83d78955 100644 --- a/docs/components/modules/ROOT/pages/salesforce-component.adoc +++ b/docs/components/modules/ROOT/pages/salesforce-component.adoc @@ -157,7 +157,7 @@ results) using result link returned from the 'query' API * recent - fetching recent items * approval - submit a record or records (batch) for approval process * approvals - fetch a list of all approval processes -* composite - submit up to 25 possibly related REST requests and receive individual responses +* composite - submit up to 25 possibly related REST requests and receive individual responses. It's also possible to use "raw" composite without limitation. * composite-tree - create up to 200 records with parent-child relationships (up to 5 levels) in one go * composite-batch - submit a composition of requests in batch * queryAll - Runs a SOQL query. It returns the results that are deleted because of a merge or delete. Also returns the information about archived Task and Event records. @@ -604,6 +604,33 @@ final Map<String, ?> accountUpdateBody = accountUpdateResult.getBody(); final SObjectCompositeResult contactCreationResult = results.stream().filter(r -> "JunctionRecord".equals(r.getReferenceId())).findFirst().get() ---- +== Using "raw" Salesforce composite + +It's possible to directly call Salesforce composite by preparing the Salesforce JSON request in the route thanks to the `rawPayload` option. + +For instance, you can have the following route: + +---- +from("timer:fire?period=2000").setBody(constant("{\n" + + " \"allOrNone\" : true,\n" + + " \"records\" : [ { \n" + + " \"attributes\" : {\"type\" : \"FOO\"},\n" + + " \"Name\" : \"123456789\",\n" + + " \"FOO\" : \"XXXX\",\n" + + " \"ACCOUNT\" : 2100.0\n" + + " \"ExternalID\" : \"EXTERNAL\"\n" + " }]\n" + + "}") + .to("salesforce:composite?rawPayload=true&sObjectName=FOO&sObjectIdName=EXTERNAL&compositeMethod=PATCH") + .log("${body}"); +---- + +The route directly creates the body as JSON and directly submit to salesforce endpoint using `rawPayload=true` option. + +With this approach, you have the complete control on the Salesforce request. + +The `compositeMethod` option allows you to define the Salesforce client method style (PATCH, PUT, POST, ...). + == Sending null values to salesforce By default, SObject fields with null values are not sent to salesforce. In order to @@ -667,11 +694,9 @@ The Salesforce component supports 74 options, which are listed below. | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -713,6 +738,8 @@ The Salesforce component supports 74 options, which are listed below. | *httpClientProperties* (common) | Used to set any properties that can be configured on the underlying HTTP client. Have a look at properties of SalesforceHttpClient and the Jetty HttpClient for all available options. | | Map | *longPollingTransportProperties* (common) | Used to set any properties that can be configured on the LongPollingTransport used by the BayeuxClient (CometD) used by the streaming api | | Map | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | *httpProxyExcludedAddresses* (proxy) | A list of addresses for which HTTP proxy server should not be used. | | Set @@ -779,11 +806,9 @@ with the following path and query parameters: | Name | Description | Default | Type | *apexMethod* (common) | APEX method name | | String | *apexQueryParams* (common) | Query params for APEX method | | Map -| *apexUrl* (common) | APEX method URL | | String | *apiVersion* (common) | Salesforce API version. | 50.0 | String | *backoffIncrement* (common) | Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto-reconnect. | 1000 | long | *batchId* (common) | Bulk API Batch ID | | String -| *compositeMethod* (common) | Composite (raw) method. | | String | *contentType* (common) | Bulk API content type, one of XML, CSV, ZIP_XML, ZIP_CSV. There are 6 enums and the value can be one of: XML, CSV, JSON, ZIP_XML, ZIP_CSV, ZIP_JSON | | ContentType | *defaultReplayId* (common) | Default replayId setting if no value is found in initialReplayIdMap | -1 | Long | *format* (common) | Payload format to use for Salesforce API calls, either JSON or XML, defaults to JSON. There are 2 enums and the value can be one of: JSON, XML | | PayloadFormat @@ -820,6 +845,8 @@ with the following path and query parameters: | *replayId* (consumer) | The replayId value to use when subscribing | | Long | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. There are 3 enums and the value can be one of: InOnly, InOut, InOptionalOut | | ExchangePattern +| *apexUrl* (producer) | APEX method URL | | String +| *compositeMethod* (producer) | Composite (raw) method. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean |===