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 7a92d98 CAMEL-12808: Salesforce: support PK chunking (#5038) 7a92d98 is described below commit 7a92d98f705ecfd5a9ea2740d619da3cf67206b3 Author: Jeremy Ross <jeremy.g.r...@gmail.com> AuthorDate: Mon Feb 8 02:22:51 2021 -0600 CAMEL-12808: Salesforce: support PK chunking (#5038) --- .../camel/catalog/docs/salesforce-component.adoc | 51 ++-- .../salesforce/SalesforceComponentConfigurer.java | 24 ++ .../salesforce/SalesforceEndpointConfigurer.java | 24 ++ .../salesforce/SalesforceEndpointUriFactory.java | 42 +-- .../camel/component/salesforce/salesforce.json | 8 + .../src/main/docs/salesforce-component.adoc | 51 ++-- .../salesforce/SalesforceEndpointConfig.java | 61 +++++ .../internal/processor/BulkApiProcessor.java | 40 ++- .../salesforce/BulkApiQueryIntegrationTest.java | 41 +++ .../dsl/SalesforceComponentBuilderFactory.java | 73 +++++ .../dsl/SalesforceEndpointBuilderFactory.java | 303 +++++++++++++++++++++ .../modules/ROOT/pages/salesforce-component.adoc | 51 ++-- 12 files changed, 686 insertions(+), 83 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 feeb12b..4d5bef8 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 @@ -223,24 +223,25 @@ request. You can use the following for `operationName`: -* createJob - Creates a Salesforce Bulk Job -* getJob - Gets a Job using its Salesforce Id -* closeJob - Closes a Job -* abortJob - Aborts a Job -* createBatch - Submits a Batch within a Bulk Job -* getBatch - Gets a Batch using Id -* getAllBatches - Gets all Batches for a Bulk Job Id -* getRequest - Gets Request data (XML/CSV) for a Batch -* getResults - Gets the results of the Batch when its complete -* createBatchQuery - Creates a Batch from an SOQL query -* getQueryResultIds - Gets a list of Result Ids for a Batch Query -* getQueryResult - Gets results for a Result Id -* getRecentReports - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. -* getReportDescription - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. -* executeSyncReport - Runs a report synchronously with or without changing filters and returns the latest summary data. -* executeAsyncReport - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. -* getReportInstances - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. -* getReportResults: Contains the results of running a report. +* *createJob* - Creates a Salesforce Bulk Job. Must supply a `JobInfo` instance in body. PK Chunking +is supported via the pkChunking* options. See an explanation https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/async_api_headers_enable_pk_chunking.htm[here]. +* *getJob* - Gets a Job using its Salesforce Id +* *closeJob* - Closes a Job +* *abortJob* - Aborts a Job +* *createBatch* - Submits a Batch within a Bulk Job +* *getBatch* - Gets a Batch using Id +* *getAllBatches* - Gets all Batches for a Bulk Job Id +* *getRequest* - Gets Request data (XML/CSV) for a Batch +* *getResults* - Gets the results of the Batch when its complete +* *createBatchQuery* - Creates a Batch from an SOQL query +* *getQueryResultIds* - Gets a list of Result Ids for a Batch Query +* *getQueryResult* - Gets results for a Result Id +* *getRecentReports* - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. +* *getReportDescription* - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. +* *executeSyncReport* - Runs a report synchronously with or without changing filters and returns the latest summary data. +* *executeAsyncReport* - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. +* *getReportInstances* - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. +* *getReportResults*: Contains the results of running a report. For example, the following producer endpoint uses the createBatch API to create a Job Batch. The in message must contain a body that can be converted into an @@ -252,7 +253,7 @@ error. [source,java] ---- -...to("salesforce:createBatchJob").. +...to("salesforce:createBatch").. ---- === Rest Streaming API @@ -721,7 +722,7 @@ for details on how to generate the DTO. // component options: START -The Salesforce component supports 75 options, which are listed below. +The Salesforce component supports 79 options, which are listed below. @@ -756,6 +757,10 @@ The Salesforce component supports 75 options, which are listed below. | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper | *packages* (common) | In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. This must be set if using the XML format. Also, set it if using the generated DTOs to gain the benefit of using short SObject names in parameters/header values. Multiple packages can be separated by comma. | | String +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String @@ -835,7 +840,7 @@ with the following path and query parameters: |=== -=== Query Parameters (45 parameters): +=== Query Parameters (49 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -864,6 +869,10 @@ with the following path and query parameters: | *notifyForOperationUndelete* (common) | Notify for un-delete operation, defaults to false (API version = 29.0) | | Boolean | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java index d4201da..24f0acad 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java @@ -134,6 +134,14 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "objectMapper": getOrCreateConfig(target).setObjectMapper(property(camelContext, com.fasterxml.jackson.databind.ObjectMapper.class, value)); return true; case "packages": target.setPackages(property(camelContext, java.lang.String.class, value)); return true; case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; + case "pkchunking": + case "pkChunking": getOrCreateConfig(target).setPkChunking(property(camelContext, java.lang.Boolean.class, value)); return true; + case "pkchunkingchunksize": + case "pkChunkingChunkSize": getOrCreateConfig(target).setPkChunkingChunkSize(property(camelContext, java.lang.Integer.class, value)); return true; + case "pkchunkingparent": + case "pkChunkingParent": getOrCreateConfig(target).setPkChunkingParent(property(camelContext, java.lang.String.class, value)); return true; + case "pkchunkingstartrow": + case "pkChunkingStartRow": getOrCreateConfig(target).setPkChunkingStartRow(property(camelContext, java.lang.String.class, value)); return true; case "querylocator": case "queryLocator": getOrCreateConfig(target).setQueryLocator(property(camelContext, java.lang.String.class, value)); return true; case "rawpayload": @@ -285,6 +293,14 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "objectMapper": return com.fasterxml.jackson.databind.ObjectMapper.class; case "packages": return java.lang.String.class; case "password": return java.lang.String.class; + case "pkchunking": + case "pkChunking": return java.lang.Boolean.class; + case "pkchunkingchunksize": + case "pkChunkingChunkSize": return java.lang.Integer.class; + case "pkchunkingparent": + case "pkChunkingParent": return java.lang.String.class; + case "pkchunkingstartrow": + case "pkChunkingStartRow": return java.lang.String.class; case "querylocator": case "queryLocator": return java.lang.String.class; case "rawpayload": @@ -437,6 +453,14 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "objectMapper": return getOrCreateConfig(target).getObjectMapper(); case "packages": return target.getPackages(); case "password": return target.getPassword(); + case "pkchunking": + case "pkChunking": return getOrCreateConfig(target).getPkChunking(); + case "pkchunkingchunksize": + case "pkChunkingChunkSize": return getOrCreateConfig(target).getPkChunkingChunkSize(); + case "pkchunkingparent": + case "pkChunkingParent": return getOrCreateConfig(target).getPkChunkingParent(); + case "pkchunkingstartrow": + case "pkChunkingStartRow": return getOrCreateConfig(target).getPkChunkingStartRow(); case "querylocator": case "queryLocator": return getOrCreateConfig(target).getQueryLocator(); case "rawpayload": diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java index 91c8420..9615232 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java @@ -77,6 +77,14 @@ public class SalesforceEndpointConfigurer extends PropertyConfigurerSupport impl case "notifyForOperations": target.getConfiguration().setNotifyForOperations(property(camelContext, org.apache.camel.component.salesforce.internal.dto.NotifyForOperationsEnum.class, value)); return true; case "objectmapper": case "objectMapper": target.getConfiguration().setObjectMapper(property(camelContext, com.fasterxml.jackson.databind.ObjectMapper.class, value)); return true; + case "pkchunking": + case "pkChunking": target.getConfiguration().setPkChunking(property(camelContext, java.lang.Boolean.class, value)); return true; + case "pkchunkingchunksize": + case "pkChunkingChunkSize": target.getConfiguration().setPkChunkingChunkSize(property(camelContext, java.lang.Integer.class, value)); return true; + case "pkchunkingparent": + case "pkChunkingParent": target.getConfiguration().setPkChunkingParent(property(camelContext, java.lang.String.class, value)); return true; + case "pkchunkingstartrow": + case "pkChunkingStartRow": target.getConfiguration().setPkChunkingStartRow(property(camelContext, java.lang.String.class, value)); return true; case "querylocator": case "queryLocator": target.getConfiguration().setQueryLocator(property(camelContext, java.lang.String.class, value)); return true; case "rawpayload": @@ -172,6 +180,14 @@ public class SalesforceEndpointConfigurer extends PropertyConfigurerSupport impl case "notifyForOperations": return org.apache.camel.component.salesforce.internal.dto.NotifyForOperationsEnum.class; case "objectmapper": case "objectMapper": return com.fasterxml.jackson.databind.ObjectMapper.class; + case "pkchunking": + case "pkChunking": return java.lang.Boolean.class; + case "pkchunkingchunksize": + case "pkChunkingChunkSize": return java.lang.Integer.class; + case "pkchunkingparent": + case "pkChunkingParent": return java.lang.String.class; + case "pkchunkingstartrow": + case "pkChunkingStartRow": return java.lang.String.class; case "querylocator": case "queryLocator": return java.lang.String.class; case "rawpayload": @@ -268,6 +284,14 @@ public class SalesforceEndpointConfigurer extends PropertyConfigurerSupport impl case "notifyForOperations": return target.getConfiguration().getNotifyForOperations(); case "objectmapper": case "objectMapper": return target.getConfiguration().getObjectMapper(); + case "pkchunking": + case "pkChunking": return target.getConfiguration().getPkChunking(); + case "pkchunkingchunksize": + case "pkChunkingChunkSize": return target.getConfiguration().getPkChunkingChunkSize(); + case "pkchunkingparent": + case "pkChunkingParent": return target.getConfiguration().getPkChunkingParent(); + case "pkchunkingstartrow": + case "pkChunkingStartRow": return target.getConfiguration().getPkChunkingStartRow(); case "querylocator": case "queryLocator": return target.getConfiguration().getQueryLocator(); case "rawpayload": diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java index 9ca4520..ea133d3 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java @@ -20,53 +20,57 @@ public class SalesforceEndpointUriFactory extends org.apache.camel.support.compo private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(47); + Set<String> props = new HashSet<>(51); props.add("initialReplayIdMap"); props.add("notifyForOperations"); props.add("sObjectQuery"); props.add("notifyForOperationCreate"); - props.add("batchId"); - props.add("notifyForOperationUndelete"); props.add("sObjectClass"); - props.add("apexUrl"); props.add("compositeMethod"); props.add("apexMethod"); - props.add("updateTopic"); props.add("apiVersion"); - props.add("instanceId"); props.add("bridgeErrorHandler"); - props.add("notifyForFields"); - props.add("sObjectIdValue"); props.add("reportMetadata"); props.add("limit"); - props.add("apexQueryParams"); props.add("queryLocator"); props.add("contentType"); - props.add("includeDetails"); props.add("sObjectFields"); props.add("sObjectName"); - props.add("httpClient"); props.add("sObjectBlobFieldName"); props.add("backoffIncrement"); - props.add("maxBackoff"); - props.add("rawPayload"); - props.add("reportId"); - props.add("resultId"); props.add("format"); - props.add("exchangePattern"); - props.add("operationName"); props.add("sObjectId"); props.add("defaultReplayId"); props.add("jobId"); - props.add("notFoundBehaviour"); props.add("lazyStartProducer"); props.add("objectMapper"); props.add("sObjectSearch"); props.add("notifyForOperationUpdate"); - props.add("topicName"); props.add("sObjectIdName"); props.add("replayId"); props.add("exceptionHandler"); + props.add("pkChunkingParent"); + props.add("batchId"); + props.add("notifyForOperationUndelete"); + props.add("apexUrl"); + props.add("updateTopic"); + props.add("instanceId"); + props.add("notifyForFields"); + props.add("sObjectIdValue"); + props.add("apexQueryParams"); + props.add("includeDetails"); + props.add("pkChunkingChunkSize"); + props.add("pkChunkingStartRow"); + props.add("httpClient"); + props.add("maxBackoff"); + props.add("rawPayload"); + props.add("reportId"); + props.add("resultId"); + props.add("exchangePattern"); + props.add("operationName"); + props.add("pkChunking"); + props.add("notFoundBehaviour"); + props.add("topicName"); props.add("notifyForOperationDelete"); PROPERTY_NAMES = Collections.unmodifiableSet(props); SECRET_PROPERTY_NAMES = Collections.emptySet(); 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 9f84f8e..bf7ac08 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 @@ -51,6 +51,10 @@ "notifyForOperationUpdate": { "kind": "property", "displayName": "Notify For Operation Update", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Notify for update operation, defaults to false (API version = 29.0)" }, "objectMapper": { "kind": "property", "displayName": "Object Mapper", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.fasterxml.jackson.databind.ObjectMapper", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Custom Jackson ObjectMapper to use when serializing\/deserializing Salesforce objects." }, "packages": { "kind": "property", "displayName": "Packages", "group": "common", "label": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. This must be set if using the XML format. Also, set it if using the generated DTOs to gain the benefit of using short SO [...] + "pkChunking": { "kind": "property", "displayName": "Pk Chunking", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary." }, + "pkChunkingChunkSize": { "kind": "property", "displayName": "Pk Chunking Chunk Size", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000." }, + "pkChunkingParent": { "kind": "property", "displayName": "Pk Chunking Parent", "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": "Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based [...] + "pkChunkingStartRow": { "kind": "property", "displayName": "Pk Chunking Start Row", "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": "Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Us [...] "queryLocator": { "kind": "property", "displayName": "Query Locator", "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": "Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. U [...] "rawPayload": { "kind": "property", "displayName": "Raw Payload", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false [...] "reportId": { "kind": "property", "displayName": "Report 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": "Salesforce1 Analytics report Id" }, @@ -125,6 +129,10 @@ "notifyForOperationUndelete": { "kind": "parameter", "displayName": "Notify For Operation Undelete", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Notify for un-delete operation, defaults to false (API version = 29.0)" }, "notifyForOperationUpdate": { "kind": "parameter", "displayName": "Notify For Operation Update", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Notify for update operation, defaults to false (API version = 29.0)" }, "objectMapper": { "kind": "parameter", "displayName": "Object Mapper", "group": "common", "label": "", "required": false, "type": "object", "javaType": "com.fasterxml.jackson.databind.ObjectMapper", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Custom Jackson ObjectMapper to use when serializing\/deserializing Salesforce objects." }, + "pkChunking": { "kind": "parameter", "displayName": "Pk Chunking", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary." }, + "pkChunkingChunkSize": { "kind": "parameter", "displayName": "Pk Chunking Chunk Size", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size [...] + "pkChunkingParent": { "kind": "parameter", "displayName": "Pk Chunking Parent", "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": "Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks ar [...] + "pkChunkingStartRow": { "kind": "parameter", "displayName": "Pk Chunking Start Row", "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": "Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first c [...] "queryLocator": { "kind": "parameter", "displayName": "Query Locator", "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": "Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single [...] "rawPayload": { "kind": "parameter", "displayName": "Raw Payload", "group": "common", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Use raw payload String for request and response (either JSON or XML depending on format), instead of DTO [...] "reportId": { "kind": "parameter", "displayName": "Report 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": "Salesforce1 Analytics report Id" }, 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 feeb12b..4d5bef8 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 @@ -223,24 +223,25 @@ request. You can use the following for `operationName`: -* createJob - Creates a Salesforce Bulk Job -* getJob - Gets a Job using its Salesforce Id -* closeJob - Closes a Job -* abortJob - Aborts a Job -* createBatch - Submits a Batch within a Bulk Job -* getBatch - Gets a Batch using Id -* getAllBatches - Gets all Batches for a Bulk Job Id -* getRequest - Gets Request data (XML/CSV) for a Batch -* getResults - Gets the results of the Batch when its complete -* createBatchQuery - Creates a Batch from an SOQL query -* getQueryResultIds - Gets a list of Result Ids for a Batch Query -* getQueryResult - Gets results for a Result Id -* getRecentReports - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. -* getReportDescription - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. -* executeSyncReport - Runs a report synchronously with or without changing filters and returns the latest summary data. -* executeAsyncReport - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. -* getReportInstances - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. -* getReportResults: Contains the results of running a report. +* *createJob* - Creates a Salesforce Bulk Job. Must supply a `JobInfo` instance in body. PK Chunking +is supported via the pkChunking* options. See an explanation https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/async_api_headers_enable_pk_chunking.htm[here]. +* *getJob* - Gets a Job using its Salesforce Id +* *closeJob* - Closes a Job +* *abortJob* - Aborts a Job +* *createBatch* - Submits a Batch within a Bulk Job +* *getBatch* - Gets a Batch using Id +* *getAllBatches* - Gets all Batches for a Bulk Job Id +* *getRequest* - Gets Request data (XML/CSV) for a Batch +* *getResults* - Gets the results of the Batch when its complete +* *createBatchQuery* - Creates a Batch from an SOQL query +* *getQueryResultIds* - Gets a list of Result Ids for a Batch Query +* *getQueryResult* - Gets results for a Result Id +* *getRecentReports* - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. +* *getReportDescription* - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. +* *executeSyncReport* - Runs a report synchronously with or without changing filters and returns the latest summary data. +* *executeAsyncReport* - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. +* *getReportInstances* - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. +* *getReportResults*: Contains the results of running a report. For example, the following producer endpoint uses the createBatch API to create a Job Batch. The in message must contain a body that can be converted into an @@ -252,7 +253,7 @@ error. [source,java] ---- -...to("salesforce:createBatchJob").. +...to("salesforce:createBatch").. ---- === Rest Streaming API @@ -721,7 +722,7 @@ for details on how to generate the DTO. // component options: START -The Salesforce component supports 75 options, which are listed below. +The Salesforce component supports 79 options, which are listed below. @@ -756,6 +757,10 @@ The Salesforce component supports 75 options, which are listed below. | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper | *packages* (common) | In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. This must be set if using the XML format. Also, set it if using the generated DTOs to gain the benefit of using short SObject names in parameters/header values. Multiple packages can be separated by comma. | | String +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String @@ -835,7 +840,7 @@ with the following path and query parameters: |=== -=== Query Parameters (45 parameters): +=== Query Parameters (49 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -864,6 +869,10 @@ with the following path and query parameters: | *notifyForOperationUndelete* (common) | Notify for un-delete operation, defaults to false (API version = 29.0) | | Boolean | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java index 1bcea41..0c9801b 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java @@ -73,6 +73,10 @@ public class SalesforceEndpointConfig implements Cloneable { public static final String BATCH_ID = "batchId"; public static final String RESULT_ID = "resultId"; public static final String QUERY_LOCATOR = "queryLocator"; + public static final String PK_CHUNKING = "pkChunking"; + public static final String PK_CHUNKING_CHUNK_SIZE = "pkChunkingChunkSize"; + public static final String PK_CHUNKING_PARENT = "pkChunkingParent"; + public static final String PK_CHUNKING_START_ROW = "pkChunkingStartRow"; // parameters for Analytics API public static final String REPORT_ID = "reportId"; @@ -145,6 +149,14 @@ public class SalesforceEndpointConfig implements Cloneable { private String resultId; @UriParam private String queryLocator; + @UriParam + private Boolean pkChunking; + @UriParam + private Integer pkChunkingChunkSize; + @UriParam + private String pkChunkingParent; + @UriParam + private String pkChunkingStartRow; // Streaming API properties @UriParam @@ -467,6 +479,55 @@ public class SalesforceEndpointConfig implements Cloneable { this.queryLocator = queryLocator; } + public Boolean getPkChunking() { + return pkChunking; + } + + /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if + * necessary. + */ + public void setPkChunking(Boolean pkChunking) { + this.pkChunking = pkChunking; + } + + public Integer getPkChunkingChunkSize() { + return pkChunkingChunkSize; + } + + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. + */ + public void setPkChunkingChunkSize(Integer pkChunkingChunkSize) { + this.pkChunkingChunkSize = pkChunkingChunkSize; + } + + public String getPkChunkingParent() { + return pkChunkingParent; + } + + /** + * Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based + * on the parent object's records rather than the sharing object's records. For example, when querying on + * AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the + * parent object is supported. + */ + public void setPkChunkingParent(String pkChunkingParent) { + this.pkChunkingParent = pkChunkingParent; + } + + public String getPkChunkingStartRow() { + return pkChunkingStartRow; + } + + /** + * Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use + * this parameter to specify a starting ID when restarting a job that failed between batches. + */ + public void setPkChunkingStartRow(String pkChunkingStartRow) { + this.pkChunkingStartRow = pkChunkingStartRow; + } + /** * Whether to update an existing Push Topic when using the Streaming API, defaults to false */ diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java index 963b9e0..5025f3f 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/BulkApiProcessor.java @@ -18,6 +18,7 @@ package org.apache.camel.component.salesforce.internal.processor; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -133,7 +134,44 @@ public class BulkApiProcessor extends AbstractSalesforceProcessor { return done; } - private void processCreateJob(final Exchange exchange, final AsyncCallback callback) throws InvalidPayloadException { + @Override + public Map<String, List<String>> determineHeaders(Exchange exchange) { + Map<String, List<String>> headers = super.determineHeaders(exchange); + try { + Boolean pkChunking = getParameter( + SalesforceEndpointConfig.PK_CHUNKING, exchange, IGNORE_BODY, IS_OPTIONAL, + Boolean.class); + if (pkChunking != null && pkChunking) { + List<String> values = new ArrayList<>(); + values.add("true"); + Integer chunkSize = getParameter( + SalesforceEndpointConfig.PK_CHUNKING_CHUNK_SIZE, exchange, IGNORE_BODY, IS_OPTIONAL, + Integer.class); + if (chunkSize != null) { + values.add("chunkSize=" + chunkSize); + } + String startRow = getParameter( + SalesforceEndpointConfig.PK_CHUNKING_START_ROW, exchange, IGNORE_BODY, IS_OPTIONAL, + String.class); + if (startRow != null) { + values.add("startRow=" + startRow); + } + String parent = getParameter( + SalesforceEndpointConfig.PK_CHUNKING_PARENT, exchange, IGNORE_BODY, IS_OPTIONAL, + String.class); + if (parent != null) { + values.add("parent=" + parent); + } + headers.put("Sforce-Enable-PKChunking", values); + } + } catch (SalesforceException e) { + throw new RuntimeException(e); + } + return headers; + } + + private void processCreateJob(final Exchange exchange, final AsyncCallback callback) + throws InvalidPayloadException, SalesforceException { JobInfo jobBody = exchange.getIn().getMandatoryBody(JobInfo.class); bulkClient.createJob(jobBody, determineHeaders(exchange), new BulkApiClient.JobInfoResponseCallback() { @Override diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiQueryIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiQueryIntegrationTest.java index 4ddef5e..97e9c65 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiQueryIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiQueryIntegrationTest.java @@ -17,7 +17,9 @@ package org.apache.camel.component.salesforce; import java.io.InputStream; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.camel.component.salesforce.api.dto.bulk.BatchInfo; import org.apache.camel.component.salesforce.api.dto.bulk.BatchStateEnum; @@ -25,6 +27,7 @@ import org.apache.camel.component.salesforce.api.dto.bulk.ContentType; import org.apache.camel.component.salesforce.api.dto.bulk.JobInfo; import org.apache.camel.component.salesforce.api.dto.bulk.OperationEnum; import org.apache.camel.component.salesforce.dto.generated.Merchandise__c; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; @@ -83,4 +86,42 @@ public class BulkApiQueryIntegrationTest extends AbstractBulkApiTestBase { template().requestBody("direct:closeJob", jobInfo, JobInfo.class); } + @Test + public void testPkChunking() throws Exception { + // create a QUERY test Job + JobInfo jobInfo = new JobInfo(); + jobInfo.setOperation(OperationEnum.QUERY); + jobInfo.setContentType(ContentType.CSV); + jobInfo.setObject(Merchandise__c.class.getSimpleName()); + Map<String, Object> headers = new HashMap<>(); + headers.put(SalesforceEndpointConfig.PK_CHUNKING, true); + headers.put(SalesforceEndpointConfig.PK_CHUNKING_CHUNK_SIZE, 1000); + jobInfo = template().requestBodyAndHeaders( + "direct:createJob", jobInfo, headers, JobInfo.class); + assertNotNull(jobInfo.getId(), "Missing JobId"); + + // test createQuery + BatchInfo batchInfo = template().requestBody("direct:createBatchQuery", jobInfo, BatchInfo.class); + assertNotNull(batchInfo, "Null batch query"); + assertNotNull(batchInfo.getId(), "Null batch query id"); + + // test getRequest + InputStream requestStream = template().requestBody("direct:getRequest", batchInfo, InputStream.class); + assertNotNull(requestStream, "Null batch request"); + + // wait for batch to finish + log.info("Waiting for query batch to finish..."); + while (!batchProcessed(batchInfo)) { + // sleep 5 seconds + Thread.sleep(5000); + // check again + batchInfo = getBatchInfo(batchInfo); + } + log.info("Query finished with state " + batchInfo.getState()); + // Because PK chunking is enabled, the original batch is given a state of Not Processed. + assertEquals(BatchStateEnum.NOT_PROCESSED, batchInfo.getState(), "Query did not succeed"); + + // close the test job + template().requestBody("direct:closeJob", jobInfo, JobInfo.class); + } } 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 6b40214..240d81c 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 @@ -501,6 +501,75 @@ public interface SalesforceComponentBuilderFactory { return this; } /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option is a: <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceComponentBuilder pkChunking( + java.lang.Boolean pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceComponentBuilder pkChunkingChunkSize( + java.lang.Integer pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Specifies the parent object when you're enabling PK chunking for + * queries on sharing objects. The chunks are based on the parent + * object's records rather than the sharing object's records. For + * example, when querying on AccountShare, specify Account as the parent + * object. PK chunking is supported for sharing objects as long as the + * parent object is supported. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingParent the value to set + * @return the dsl builder + */ + default SalesforceComponentBuilder pkChunkingParent( + java.lang.String pkChunkingParent) { + doSetProperty("pkChunkingParent", pkChunkingParent); + return this; + } + /** + * Specifies the 15-character or 18-character record ID to be used as + * the lower boundary for the first chunk. Use this parameter to specify + * a starting ID when restarting a job that failed between batches. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingStartRow the value to set + * @return the dsl builder + */ + default SalesforceComponentBuilder pkChunkingStartRow( + java.lang.String pkChunkingStartRow) { + doSetProperty("pkChunkingStartRow", pkChunkingStartRow); + return this; + } + /** * Query Locator provided by salesforce for use when a query results in * more records than can be retrieved in a single call. Use this value * in a subsequent call to retrieve additional records. @@ -1331,6 +1400,10 @@ public interface SalesforceComponentBuilderFactory { case "notifyForOperationUpdate": getOrCreateConfiguration((SalesforceComponent) component).setNotifyForOperationUpdate((java.lang.Boolean) value); return true; case "objectMapper": getOrCreateConfiguration((SalesforceComponent) component).setObjectMapper((com.fasterxml.jackson.databind.ObjectMapper) value); return true; case "packages": ((SalesforceComponent) component).setPackages((java.lang.String) value); return true; + case "pkChunking": getOrCreateConfiguration((SalesforceComponent) component).setPkChunking((java.lang.Boolean) value); return true; + case "pkChunkingChunkSize": getOrCreateConfiguration((SalesforceComponent) component).setPkChunkingChunkSize((java.lang.Integer) value); return true; + case "pkChunkingParent": getOrCreateConfiguration((SalesforceComponent) component).setPkChunkingParent((java.lang.String) value); return true; + case "pkChunkingStartRow": getOrCreateConfiguration((SalesforceComponent) component).setPkChunkingStartRow((java.lang.String) value); return true; case "queryLocator": getOrCreateConfiguration((SalesforceComponent) component).setQueryLocator((java.lang.String) value); return true; case "rawPayload": getOrCreateConfiguration((SalesforceComponent) component).setRawPayload((boolean) value); return true; case "reportId": getOrCreateConfiguration((SalesforceComponent) component).setReportId((java.lang.String) 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 bea7920..4a81141 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 @@ -702,6 +702,107 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option is a: <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunking(Boolean pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option will be converted to a + * <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunking(String pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunkingChunkSize( + Integer pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option will be converted to a + * <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunkingChunkSize( + String pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Specifies the parent object when you're enabling PK chunking for + * queries on sharing objects. The chunks are based on the parent + * object's records rather than the sharing object's records. For + * example, when querying on AccountShare, specify Account as the parent + * object. PK chunking is supported for sharing objects as long as the + * parent object is supported. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingParent the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunkingParent( + String pkChunkingParent) { + doSetProperty("pkChunkingParent", pkChunkingParent); + return this; + } + /** + * Specifies the 15-character or 18-character record ID to be used as + * the lower boundary for the first chunk. Use this parameter to specify + * a starting ID when restarting a job that failed between batches. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingStartRow the value to set + * @return the dsl builder + */ + default SalesforceEndpointConsumerBuilder pkChunkingStartRow( + String pkChunkingStartRow) { + doSetProperty("pkChunkingStartRow", pkChunkingStartRow); + return this; + } + /** * Query Locator provided by salesforce for use when a query results in * more records than can be retrieved in a single call. Use this value * in a subsequent call to retrieve additional records. @@ -1805,6 +1906,107 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option is a: <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunking(Boolean pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option will be converted to a + * <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunking(String pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunkingChunkSize( + Integer pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option will be converted to a + * <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunkingChunkSize( + String pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Specifies the parent object when you're enabling PK chunking for + * queries on sharing objects. The chunks are based on the parent + * object's records rather than the sharing object's records. For + * example, when querying on AccountShare, specify Account as the parent + * object. PK chunking is supported for sharing objects as long as the + * parent object is supported. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingParent the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunkingParent( + String pkChunkingParent) { + doSetProperty("pkChunkingParent", pkChunkingParent); + return this; + } + /** + * Specifies the 15-character or 18-character record ID to be used as + * the lower boundary for the first chunk. Use this parameter to specify + * a starting ID when restarting a job that failed between batches. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingStartRow the value to set + * @return the dsl builder + */ + default SalesforceEndpointProducerBuilder pkChunkingStartRow( + String pkChunkingStartRow) { + doSetProperty("pkChunkingStartRow", pkChunkingStartRow); + return this; + } + /** * Query Locator provided by salesforce for use when a query results in * more records than can be retrieved in a single call. Use this value * in a subsequent call to retrieve additional records. @@ -2833,6 +3035,107 @@ public interface SalesforceEndpointBuilderFactory { return this; } /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option is a: <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunking(Boolean pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API + * performs PK chunking automatically, if necessary. + * + * The option will be converted to a + * <code>java.lang.Boolean</code> type. + * + * Group: common + * + * @param pkChunking the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunking(String pkChunking) { + doSetProperty("pkChunking", pkChunking); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunkingChunkSize( + Integer pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Chunk size for use with PK Chunking. If unspecified, salesforce + * default is 100,000. Maximum size is 250,000. + * + * The option will be converted to a + * <code>java.lang.Integer</code> type. + * + * Group: common + * + * @param pkChunkingChunkSize the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunkingChunkSize( + String pkChunkingChunkSize) { + doSetProperty("pkChunkingChunkSize", pkChunkingChunkSize); + return this; + } + /** + * Specifies the parent object when you're enabling PK chunking for + * queries on sharing objects. The chunks are based on the parent + * object's records rather than the sharing object's records. For + * example, when querying on AccountShare, specify Account as the parent + * object. PK chunking is supported for sharing objects as long as the + * parent object is supported. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingParent the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunkingParent( + String pkChunkingParent) { + doSetProperty("pkChunkingParent", pkChunkingParent); + return this; + } + /** + * Specifies the 15-character or 18-character record ID to be used as + * the lower boundary for the first chunk. Use this parameter to specify + * a starting ID when restarting a job that failed between batches. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: common + * + * @param pkChunkingStartRow the value to set + * @return the dsl builder + */ + default SalesforceEndpointBuilder pkChunkingStartRow( + String pkChunkingStartRow) { + doSetProperty("pkChunkingStartRow", pkChunkingStartRow); + return this; + } + /** * Query Locator provided by salesforce for use when a query results in * more records than can be retrieved in a single call. Use this value * in a subsequent call to retrieve additional records. diff --git a/docs/components/modules/ROOT/pages/salesforce-component.adoc b/docs/components/modules/ROOT/pages/salesforce-component.adoc index 8c4ecb6..79a59f6 100644 --- a/docs/components/modules/ROOT/pages/salesforce-component.adoc +++ b/docs/components/modules/ROOT/pages/salesforce-component.adoc @@ -225,24 +225,25 @@ request. You can use the following for `operationName`: -* createJob - Creates a Salesforce Bulk Job -* getJob - Gets a Job using its Salesforce Id -* closeJob - Closes a Job -* abortJob - Aborts a Job -* createBatch - Submits a Batch within a Bulk Job -* getBatch - Gets a Batch using Id -* getAllBatches - Gets all Batches for a Bulk Job Id -* getRequest - Gets Request data (XML/CSV) for a Batch -* getResults - Gets the results of the Batch when its complete -* createBatchQuery - Creates a Batch from an SOQL query -* getQueryResultIds - Gets a list of Result Ids for a Batch Query -* getQueryResult - Gets results for a Result Id -* getRecentReports - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. -* getReportDescription - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. -* executeSyncReport - Runs a report synchronously with or without changing filters and returns the latest summary data. -* executeAsyncReport - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. -* getReportInstances - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. -* getReportResults: Contains the results of running a report. +* *createJob* - Creates a Salesforce Bulk Job. Must supply a `JobInfo` instance in body. PK Chunking +is supported via the pkChunking* options. See an explanation https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/async_api_headers_enable_pk_chunking.htm[here]. +* *getJob* - Gets a Job using its Salesforce Id +* *closeJob* - Closes a Job +* *abortJob* - Aborts a Job +* *createBatch* - Submits a Batch within a Bulk Job +* *getBatch* - Gets a Batch using Id +* *getAllBatches* - Gets all Batches for a Bulk Job Id +* *getRequest* - Gets Request data (XML/CSV) for a Batch +* *getResults* - Gets the results of the Batch when its complete +* *createBatchQuery* - Creates a Batch from an SOQL query +* *getQueryResultIds* - Gets a list of Result Ids for a Batch Query +* *getQueryResult* - Gets results for a Result Id +* *getRecentReports* - Gets up to 200 of the reports you most recently viewed by sending a GET request to the Report List resource. +* *getReportDescription* - Retrieves the report, report type, and related metadata for a report, either in a tabular or summary or matrix format. +* *executeSyncReport* - Runs a report synchronously with or without changing filters and returns the latest summary data. +* *executeAsyncReport* - Runs an instance of a report asynchronously with or without filters and returns the summary data with or without details. +* *getReportInstances* - Returns a list of instances for a report that you requested to be run asynchronously. Each item in the list is treated as a separate instance of the report. +* *getReportResults*: Contains the results of running a report. For example, the following producer endpoint uses the createBatch API to create a Job Batch. The in message must contain a body that can be converted into an @@ -254,7 +255,7 @@ error. [source,java] ---- -...to("salesforce:createBatchJob").. +...to("salesforce:createBatch").. ---- === Rest Streaming API @@ -723,7 +724,7 @@ for details on how to generate the DTO. // component options: START -The Salesforce component supports 75 options, which are listed below. +The Salesforce component supports 79 options, which are listed below. @@ -758,6 +759,10 @@ The Salesforce component supports 75 options, which are listed below. | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper | *packages* (common) | In what packages are the generated DTO classes. Typically the classes would be generated using camel-salesforce-maven-plugin. This must be set if using the XML format. Also, set it if using the generated DTOs to gain the benefit of using short SObject names in parameters/header values. Multiple packages can be separated by comma. | | String +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String @@ -837,7 +842,7 @@ with the following path and query parameters: |=== -=== Query Parameters (45 parameters): +=== Query Parameters (49 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -866,6 +871,10 @@ with the following path and query parameters: | *notifyForOperationUndelete* (common) | Notify for un-delete operation, defaults to false (API version = 29.0) | | Boolean | *notifyForOperationUpdate* (common) | Notify for update operation, defaults to false (API version = 29.0) | | Boolean | *objectMapper* (common) | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects. | | ObjectMapper +| *pkChunking* (common) | Use PK Chunking. Only for use in original Bulk API. Bulk 2.0 API performs PK chunking automatically, if necessary. | | Boolean +| *pkChunkingChunkSize* (common) | Chunk size for use with PK Chunking. If unspecified, salesforce default is 100,000. Maximum size is 250,000. | | Integer +| *pkChunkingParent* (common) | Specifies the parent object when you're enabling PK chunking for queries on sharing objects. The chunks are based on the parent object's records rather than the sharing object's records. For example, when querying on AccountShare, specify Account as the parent object. PK chunking is supported for sharing objects as long as the parent object is supported. | | String +| *pkChunkingStartRow* (common) | Specifies the 15-character or 18-character record ID to be used as the lower boundary for the first chunk. Use this parameter to specify a starting ID when restarting a job that failed between batches. | | String | *queryLocator* (common) | Query Locator provided by salesforce for use when a query results in more records than can be retrieved in a single call. Use this value in a subsequent call to retrieve additional records. | | String | *rawPayload* (common) | Use raw payload String for request and response (either JSON or XML depending on format), instead of DTOs, false by default | false | boolean | *reportId* (common) | Salesforce1 Analytics report Id | | String