You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/11/28 22:28:12 UTC
[camel] branch master updated: CAMEL-15904: camel-salesforce:
streaming replayId default (#4698)
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 20ea5ec CAMEL-15904: camel-salesforce: streaming replayId default (#4698)
20ea5ec is described below
commit 20ea5ec2b4b18a9e6371e4441d4ff706c245e038
Author: Jeremy Ross <je...@jeremyross.org>
AuthorDate: Sat Nov 28 16:27:46 2020 -0600
CAMEL-15904: camel-salesforce: streaming replayId default (#4698)
* CAMEL-15904: camel-salesforce: streaming replayId default
Salesforce now requires a value for replayId, so defaulting to -1.
* Remove invalid javadoc syntax.
---
.../org/apache/camel/catalog/docs/salesforce-component.adoc | 4 ++--
.../org/apache/camel/component/salesforce/salesforce.json | 4 ++--
.../src/main/docs/salesforce-component.adoc | 4 ++--
.../camel/component/salesforce/SalesforceEndpointConfig.java | 6 ++++--
.../camel/component/salesforce/StreamingApiIntegrationTest.java | 9 +++++----
.../builder/component/dsl/SalesforceComponentBuilderFactory.java | 1 +
.../builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java | 6 ++++++
docs/components/modules/ROOT/pages/salesforce-component.adoc | 4 ++--
8 files changed, 24 insertions(+), 14 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 d230d0b..6747737 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
@@ -670,7 +670,7 @@ The Salesforce component supports 73 options, which are listed below.
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *httpClientConnectionTimeout* (common) | Connection timeout used by the HttpClient when connecting to the Salesforce server. | 60000 | long
@@ -781,7 +781,7 @@ with the following path and query parameters:
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *includeDetails* (common) | Include details in Salesforce1 Analytics report, defaults to 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 a9e7ddd..3963932 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
@@ -30,7 +30,7 @@
"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" },
"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, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Default replayId setting if no value is found in initialReplayIdMap" },
+ "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 [...]
"httpClient": { "kind": "property", "displayName": "Http Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.SalesforceHttpClient", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Custom Jetty Http Client to use to connect to Salesforce." },
"httpClientConnectionTimeout": { "kind": "property", "displayName": "Http Client Connection Timeout", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 60000, "description": "Connection timeout used by the HttpClient when connecting to the Salesforce server." },
@@ -107,7 +107,7 @@
"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" },
"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, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Default replayId setting if no value is found in initialReplayIdMap" },
+ "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 [...]
"httpClient": { "kind": "parameter", "displayName": "Http Client", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.SalesforceHttpClient", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "configuration", "description": "Custom Jetty Http Client to use to connect to Salesforce." },
"includeDetails": { "kind": "parameter", "displayName": "Include Details", "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": "Include details in Salesforce1 Analytics report, defaults to false." },
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 d230d0b..6747737 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
@@ -670,7 +670,7 @@ The Salesforce component supports 73 options, which are listed below.
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *httpClientConnectionTimeout* (common) | Connection timeout used by the HttpClient when connecting to the Salesforce server. | 60000 | long
@@ -781,7 +781,7 @@ with the following path and query parameters:
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *includeDetails* (common) | Include details in Salesforce1 Analytics report, defaults to false. | | Boolean
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 ca9ce28..b3a7578 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
@@ -81,6 +81,7 @@ public class SalesforceEndpointConfig implements Cloneable {
// parameters for Streaming API
public static final String DEFAULT_REPLAY_ID = "defaultReplayId";
public static final String INITIAL_REPLAY_ID_MAP = "initialReplayIdMap";
+ public static final long REPLAY_FROM_TIP = -1L;
// parameters for Approval API
public static final String APPROVAL = "approval";
@@ -166,8 +167,9 @@ public class SalesforceEndpointConfig implements Cloneable {
private String instanceId;
// Streaming API properties
- @UriParam
- private Long defaultReplayId;
+ @UriParam(description = "Default replayId setting if no value is found in initialReplayIdMap",
+ defaultValue = "" + REPLAY_FROM_TIP)
+ private Long defaultReplayId = REPLAY_FROM_TIP;
@UriParam
private Map<String, Long> initialReplayIdMap;
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
index c0d6232..72e5137 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
@@ -21,7 +21,7 @@ import java.time.ZonedDateTime;
import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.salesforce.api.dto.CreateSObjectResult;
+import org.apache.camel.component.salesforce.api.dto.UpsertSObjectResult;
import org.apache.camel.component.salesforce.dto.generated.Merchandise__c;
import org.apache.camel.component.salesforce.internal.dto.QueryRecordsPushTopic;
import org.junit.jupiter.api.Test;
@@ -49,10 +49,12 @@ public class StreamingApiIntegrationTest extends AbstractSalesforceTestBase {
Merchandise__c merchandise = new Merchandise__c();
merchandise.setName("TestNotification");
- merchandise.setDescription__c("Merchandise for testing Streaming API updated on " + ZonedDateTime.now().toString());
+ merchandise.setDescription__c("Merchandise for testing Streaming API updated on " +
+ ZonedDateTime.now().toString());
merchandise.setPrice__c(9.99);
merchandise.setTotal_Inventory__c(1000.0);
- CreateSObjectResult result = template().requestBody("direct:upsertSObject", merchandise, CreateSObjectResult.class);
+ UpsertSObjectResult result = template().requestBody("direct:upsertSObject", merchandise,
+ UpsertSObjectResult.class);
assertTrue(result == null || result.getSuccess(), "Merchandise test record not created");
try {
@@ -67,7 +69,6 @@ public class StreamingApiIntegrationTest extends AbstractSalesforceTestBase {
assertNotNull(merchandise.getName(), "Missing field Name");
// validate dynamic message headers
- assertNotNull(in.getHeader("CamelSalesforceClientId"), "Missing header CamelSalesforceClientId");
assertNotNull(in.getHeader("CamelSalesforceEventType"), "Missing header CamelSalesforceEventType");
assertNotNull(in.getHeader("CamelSalesforceCreatedDate"), "Missing header CamelSalesforceCreatedDate");
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 7b2d469..ef9c814 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
@@ -140,6 +140,7 @@ public interface SalesforceComponentBuilderFactory {
*
* The option is a: <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceComponentBuilder defaultReplayId(
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 7d0c29d..85dcf69 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
@@ -172,6 +172,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option is a: <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointConsumerBuilder defaultReplayId(
@@ -184,6 +185,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option will be converted to a <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointConsumerBuilder defaultReplayId(
@@ -1091,6 +1093,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option is a: <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointProducerBuilder defaultReplayId(
@@ -1103,6 +1106,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option will be converted to a <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointProducerBuilder defaultReplayId(
@@ -1933,6 +1937,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option is a: <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointBuilder defaultReplayId(Long defaultReplayId) {
@@ -1944,6 +1949,7 @@ public interface SalesforceEndpointBuilderFactory {
*
* The option will be converted to a <code>java.lang.Long</code> type.
*
+ * Default: -1
* Group: common
*/
default SalesforceEndpointBuilder defaultReplayId(String defaultReplayId) {
diff --git a/docs/components/modules/ROOT/pages/salesforce-component.adoc b/docs/components/modules/ROOT/pages/salesforce-component.adoc
index 984fdb1..34e3bdf9 100644
--- a/docs/components/modules/ROOT/pages/salesforce-component.adoc
+++ b/docs/components/modules/ROOT/pages/salesforce-component.adoc
@@ -672,7 +672,7 @@ The Salesforce component supports 73 options, which are listed below.
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *httpClientConnectionTimeout* (common) | Connection timeout used by the HttpClient when connecting to the Salesforce server. | 60000 | long
@@ -783,7 +783,7 @@ with the following path and query parameters:
| *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
| *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 | | Long
+| *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
| *httpClient* (common) | Custom Jetty Http Client to use to connect to Salesforce. | | SalesforceHttpClient
| *includeDetails* (common) | Include details in Salesforce1 Analytics report, defaults to false. | | Boolean