This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit cb814f99382278733fa32b5db331de071a344f92 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Thu Nov 26 15:33:16 2020 +0100 CAMEL-15806 - Camel-AWS2-SNS: Support FIFO Topic --- .../camel/catalog/docs/aws2-sns-component.adoc | 8 ++- .../aws2/sns/Sns2ComponentConfigurer.java | 12 ++++ .../component/aws2/sns/Sns2EndpointConfigurer.java | 12 ++++ .../component/aws2/sns/Sns2EndpointUriFactory.java | 4 +- .../apache/camel/component/aws2/sns/aws2-sns.json | 4 ++ .../src/main/docs/aws2-sns-component.adoc | 8 ++- ...ts.java => ConstantMessageGroupIdStrategy.java} | 15 ++--- ... ExchangeIdMessageDeduplicationIdStrategy.java} | 15 ++--- ....java => ExchangeIdMessageGroupIdStrategy.java} | 15 ++--- ...ts.java => MessageDeduplicationIdStrategy.java} | 12 ++-- ...2Constants.java => MessageGroupIdStrategy.java} | 12 ++-- ...ava => NullMessageDeduplicationIdStrategy.java} | 15 ++--- ...va => PropertyValueMessageGroupIdStrategy.java} | 15 ++--- .../component/aws2/sns/Sns2Configuration.java | 62 ++++++++++++++++++++ .../camel/component/aws2/sns/Sns2Constants.java | 1 + .../camel/component/aws2/sns/Sns2Endpoint.java | 8 ++- .../camel/component/aws2/sns/Sns2Producer.java | 16 ++++++ .../SnsComponentFifoIntegrationTest.java | 66 ++++++++++++++++++++++ .../dsl/Aws2SnsComponentBuilderFactory.java | 33 +++++++++++ .../endpoint/dsl/Sns2EndpointBuilderFactory.java | 66 ++++++++++++++++++++++ .../modules/ROOT/pages/aws2-sns-component.adoc | 8 ++- 21 files changed, 350 insertions(+), 57 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc index 7244117..ba551be 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-sns-component.adoc @@ -45,7 +45,7 @@ The topic will be created if they don't already exists. + // component options: START -The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below. +The AWS 2 Simple Notification System (SNS) component supports 22 options, which are listed below. @@ -57,6 +57,8 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which | *configuration* (producer) | Component configuration | | Sns2Configuration | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String @@ -98,7 +100,7 @@ with the following path and query parameters: |=== -=== Query Parameters (20 parameters): +=== Query Parameters (22 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -109,6 +111,8 @@ with the following path and query parameters: | *headerFilterStrategy* (producer) | To use a custom HeaderFilterStrategy to map headers to/from Camel. | | HeaderFilterStrategy | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java index ff85612..2813209 100644 --- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java +++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2ComponentConfigurer.java @@ -41,6 +41,10 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement case "kmsMasterKeyId": getOrCreateConfiguration(target).setKmsMasterKeyId(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": getOrCreateConfiguration(target).setMessageDeduplicationIdStrategy(property(camelContext, java.lang.String.class, value)); return true; + case "messagegroupidstrategy": + case "messageGroupIdStrategy": getOrCreateConfiguration(target).setMessageGroupIdStrategy(property(camelContext, java.lang.String.class, value)); return true; case "messagestructure": case "messageStructure": getOrCreateConfiguration(target).setMessageStructure(property(camelContext, java.lang.String.class, value)); return true; case "policy": getOrCreateConfiguration(target).setPolicy(property(camelContext, java.lang.String.class, value)); return true; @@ -89,6 +93,10 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement case "kmsMasterKeyId": return java.lang.String.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": return java.lang.String.class; + case "messagegroupidstrategy": + case "messageGroupIdStrategy": return java.lang.String.class; case "messagestructure": case "messageStructure": return java.lang.String.class; case "policy": return java.lang.String.class; @@ -133,6 +141,10 @@ public class Sns2ComponentConfigurer extends PropertyConfigurerSupport implement case "kmsMasterKeyId": return getOrCreateConfiguration(target).getKmsMasterKeyId(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": return getOrCreateConfiguration(target).getMessageDeduplicationIdStrategy(); + case "messagegroupidstrategy": + case "messageGroupIdStrategy": return getOrCreateConfiguration(target).getMessageGroupIdStrategy(); case "messagestructure": case "messageStructure": return getOrCreateConfiguration(target).getMessageStructure(); case "policy": return getOrCreateConfiguration(target).getPolicy(); diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java index f551b0f..c009c26 100644 --- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java +++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointConfigurer.java @@ -33,6 +33,10 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements case "kmsMasterKeyId": target.getConfiguration().setKmsMasterKeyId(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": target.getConfiguration().setMessageDeduplicationIdStrategy(property(camelContext, java.lang.String.class, value)); return true; + case "messagegroupidstrategy": + case "messageGroupIdStrategy": target.getConfiguration().setMessageGroupIdStrategy(property(camelContext, java.lang.String.class, value)); return true; case "messagestructure": case "messageStructure": target.getConfiguration().setMessageStructure(property(camelContext, java.lang.String.class, value)); return true; case "policy": target.getConfiguration().setPolicy(property(camelContext, java.lang.String.class, value)); return true; @@ -81,6 +85,10 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements case "kmsMasterKeyId": return java.lang.String.class; case "lazystartproducer": case "lazyStartProducer": return boolean.class; + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": return java.lang.String.class; + case "messagegroupidstrategy": + case "messageGroupIdStrategy": return java.lang.String.class; case "messagestructure": case "messageStructure": return java.lang.String.class; case "policy": return java.lang.String.class; @@ -125,6 +133,10 @@ public class Sns2EndpointConfigurer extends PropertyConfigurerSupport implements case "kmsMasterKeyId": return target.getConfiguration().getKmsMasterKeyId(); case "lazystartproducer": case "lazyStartProducer": return target.isLazyStartProducer(); + case "messagededuplicationidstrategy": + case "messageDeduplicationIdStrategy": return target.getConfiguration().getMessageDeduplicationIdStrategy(); + case "messagegroupidstrategy": + case "messageGroupIdStrategy": return target.getConfiguration().getMessageGroupIdStrategy(); case "messagestructure": case "messageStructure": return target.getConfiguration().getMessageStructure(); case "policy": return target.getConfiguration().getPolicy(); diff --git a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java index c2a7e5a..632004e 100644 --- a/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java +++ b/components/camel-aws2-sns/src/generated/java/org/apache/camel/component/aws2/sns/Sns2EndpointUriFactory.java @@ -20,13 +20,14 @@ public class Sns2EndpointUriFactory extends org.apache.camel.support.component.E private static final Set<String> PROPERTY_NAMES; private static final Set<String> SECRET_PROPERTY_NAMES; static { - Set<String> props = new HashSet<>(21); + Set<String> props = new HashSet<>(23); props.add("serverSideEncryptionEnabled"); props.add("autoCreateTopic"); props.add("proxyProtocol"); props.add("secretKey"); props.add("subject"); props.add("synchronous"); + props.add("messageDeduplicationIdStrategy"); props.add("subscribeSNStoSQS"); props.add("queueUrl"); props.add("messageStructure"); @@ -35,6 +36,7 @@ public class Sns2EndpointUriFactory extends org.apache.camel.support.component.E props.add("trustAllCertificates"); props.add("proxyPort"); props.add("lazyStartProducer"); + props.add("messageGroupIdStrategy"); props.add("headerFilterStrategy"); props.add("accessKey"); props.add("topicNameOrArn"); diff --git a/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json b/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json index 6ac26c6..0443756 100644 --- a/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json +++ b/components/camel-aws2-sns/src/generated/resources/org/apache/camel/component/aws2/sns/aws2-sns.json @@ -27,6 +27,8 @@ "configuration": { "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.aws2.sns.Sns2Configuration", "deprecated": false, "autowired": false, "secret": false, "description": "Component configuration" }, "kmsMasterKeyId": { "kind": "property", "displayName": "Kms Master Key Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK." }, "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] + "messageDeduplicationIdStrategy": { "kind": "property", "displayName": "Message Deduplication Id Strategy", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "useExchangeId", "useContentBasedDeduplication" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "useExchangeId", "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", [...] + "messageGroupIdStrategy": { "kind": "property", "displayName": "Message Group Id Strategy", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "useConstant", "useExchangeId", "usePropertyValue" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Only for FIFO Topic. Strategy [...] "messageStructure": { "kind": "property", "displayName": "Message Structure", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The message structure to use such as json" }, "policy": { "kind": "property", "displayName": "Policy", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The policy for this queue" }, "proxyHost": { "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SNS client" }, @@ -50,6 +52,8 @@ "headerFilterStrategy": { "kind": "parameter", "displayName": "Header Filter Strategy", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.spi.HeaderFilterStrategy", "deprecated": false, "autowired": false, "secret": false, "description": "To use a custom HeaderFilterStrategy to map headers to\/from Camel." }, "kmsMasterKeyId": { "kind": "parameter", "displayName": "Kms Master Key Id", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK." }, "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] + "messageDeduplicationIdStrategy": { "kind": "parameter", "displayName": "Message Deduplication Id Strategy", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "useExchangeId", "useContentBasedDeduplication" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "useExchangeId", "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration" [...] + "messageGroupIdStrategy": { "kind": "parameter", "displayName": "Message Group Id Strategy", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "useConstant", "useExchangeId", "usePropertyValue" ], "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "Only for FIFO Topic. Strateg [...] "messageStructure": { "kind": "parameter", "displayName": "Message Structure", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The message structure to use such as json" }, "policy": { "kind": "parameter", "displayName": "Policy", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "The policy for this queue" }, "proxyHost": { "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.sns.Sns2Configuration", "configurationField": "configuration", "description": "To define a proxy host when instantiating the SNS client" }, diff --git a/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc b/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc index 7244117..ba551be 100644 --- a/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc +++ b/components/camel-aws2-sns/src/main/docs/aws2-sns-component.adoc @@ -45,7 +45,7 @@ The topic will be created if they don't already exists. + // component options: START -The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below. +The AWS 2 Simple Notification System (SNS) component supports 22 options, which are listed below. @@ -57,6 +57,8 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which | *configuration* (producer) | Component configuration | | Sns2Configuration | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String @@ -98,7 +100,7 @@ with the following path and query parameters: |=== -=== Query Parameters (20 parameters): +=== Query Parameters (22 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -109,6 +111,8 @@ with the following path and query parameters: | *headerFilterStrategy* (producer) | To use a custom HeaderFilterStrategy to map headers to/from Camel. | | HeaderFilterStrategy | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ConstantMessageGroupIdStrategy.java similarity index 78% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ConstantMessageGroupIdStrategy.java index 8a7cb30..2ed33ad 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ConstantMessageGroupIdStrategy.java @@ -16,12 +16,13 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public class ConstantMessageGroupIdStrategy implements MessageGroupIdStrategy { + + @Override + public String getMessageGroupId(Exchange exchange) { + return "CamelSingleMessageGroup"; + } - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageDeduplicationIdStrategy.java similarity index 76% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageDeduplicationIdStrategy.java index 8a7cb30..03a42a2 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageDeduplicationIdStrategy.java @@ -16,12 +16,13 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public class ExchangeIdMessageDeduplicationIdStrategy implements MessageDeduplicationIdStrategy { + + @Override + public String getMessageDeduplicationId(Exchange exchange) { + return exchange.getExchangeId(); + } - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageGroupIdStrategy.java similarity index 78% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageGroupIdStrategy.java index 8a7cb30..0204790 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/ExchangeIdMessageGroupIdStrategy.java @@ -16,12 +16,13 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public class ExchangeIdMessageGroupIdStrategy implements MessageGroupIdStrategy { + + @Override + public String getMessageGroupId(Exchange exchange) { + return exchange.getExchangeId(); + } - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageDeduplicationIdStrategy.java similarity index 78% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageDeduplicationIdStrategy.java index 8a7cb30..62f7d20 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageDeduplicationIdStrategy.java @@ -16,12 +16,10 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public interface MessageDeduplicationIdStrategy { + + String getMessageDeduplicationId(Exchange exchange); - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageGroupIdStrategy.java similarity index 78% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageGroupIdStrategy.java index 8a7cb30..74bda2d 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/MessageGroupIdStrategy.java @@ -16,12 +16,10 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public interface MessageGroupIdStrategy { + + String getMessageGroupId(Exchange exchange); - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/NullMessageDeduplicationIdStrategy.java similarity index 78% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/NullMessageDeduplicationIdStrategy.java index 8a7cb30..638adeb 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/NullMessageDeduplicationIdStrategy.java @@ -16,12 +16,13 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public class NullMessageDeduplicationIdStrategy implements MessageDeduplicationIdStrategy { + + @Override + public String getMessageDeduplicationId(Exchange exchange) { + return null; + } - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/PropertyValueMessageGroupIdStrategy.java similarity index 74% copy from components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java copy to components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/PropertyValueMessageGroupIdStrategy.java index 8a7cb30..57ac2af 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/PropertyValueMessageGroupIdStrategy.java @@ -16,12 +16,13 @@ */ package org.apache.camel.component.aws2.sns; -/** - * Constants used in Camel AWS SNS module - */ -public interface Sns2Constants { +import org.apache.camel.Exchange; + +public class PropertyValueMessageGroupIdStrategy implements MessageGroupIdStrategy { + + @Override + public String getMessageGroupId(Exchange exchange) { + return exchange.getProperty(Sns2Constants.MESSAGE_GROUP_ID_PROPERTY, String.class); + } - String MESSAGE_ID = "CamelAwsSnsMessageId"; - String SUBJECT = "CamelAwsSnsSubject"; - String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java index 043116b..e0fd80d 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java @@ -67,6 +67,11 @@ public class Sns2Configuration implements Cloneable { private boolean trustAllCertificates; @UriParam(defaultValue = "false") private boolean useDefaultCredentialsProvider; + @UriParam(label = "producer", javaType = "java.lang.String", enums = "useConstant,useExchangeId,usePropertyValue") + private MessageGroupIdStrategy messageGroupIdStrategy; + @UriParam(label = "producer", javaType = "java.lang.String", defaultValue = "useExchangeId", + enums = "useExchangeId,useContentBasedDeduplication") + private MessageDeduplicationIdStrategy messageDeduplicationIdStrategy = new ExchangeIdMessageDeduplicationIdStrategy(); public String getSubject() { return subject; @@ -279,6 +284,54 @@ public class Sns2Configuration implements Cloneable { this.useDefaultCredentialsProvider = useDefaultCredentialsProvider; } + /** + * Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: + * *useConstant*, *useExchangeId*, *usePropertyValue*. For the *usePropertyValue* option, the value of property + * "CamelAwsMessageGroupId" will be used. + */ + public void setMessageGroupIdStrategy(String strategy) { + if ("useConstant".equalsIgnoreCase(strategy)) { + messageGroupIdStrategy = new ConstantMessageGroupIdStrategy(); + } else if ("useExchangeId".equalsIgnoreCase(strategy)) { + messageGroupIdStrategy = new ExchangeIdMessageGroupIdStrategy(); + } else if ("usePropertyValue".equalsIgnoreCase(strategy)) { + messageGroupIdStrategy = new PropertyValueMessageGroupIdStrategy(); + } else { + throw new IllegalArgumentException("Unrecognised MessageGroupIdStrategy: " + strategy); + } + } + + public void setMessageGroupIdStrategy(MessageGroupIdStrategy messageGroupIdStrategy) { + this.messageGroupIdStrategy = messageGroupIdStrategy; + } + + public MessageGroupIdStrategy getMessageGroupIdStrategy() { + return messageGroupIdStrategy; + } + + public MessageDeduplicationIdStrategy getMessageDeduplicationIdStrategy() { + return messageDeduplicationIdStrategy; + } + + /** + * Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following + * options: *useExchangeId*, *useContentBasedDeduplication*. For the *useContentBasedDeduplication* option, no + * messageDeduplicationId will be set on the message. + */ + public void setMessageDeduplicationIdStrategy(String strategy) { + if ("useExchangeId".equalsIgnoreCase(strategy)) { + messageDeduplicationIdStrategy = new ExchangeIdMessageDeduplicationIdStrategy(); + } else if ("useContentBasedDeduplication".equalsIgnoreCase(strategy)) { + messageDeduplicationIdStrategy = new NullMessageDeduplicationIdStrategy(); + } else { + throw new IllegalArgumentException("Unrecognised MessageDeduplicationIdStrategy: " + strategy); + } + } + + public void setMessageDeduplicationIdStrategy(MessageDeduplicationIdStrategy messageDeduplicationIdStrategy) { + this.messageDeduplicationIdStrategy = messageDeduplicationIdStrategy; + } + // ************************************************* // // ************************************************* @@ -290,4 +343,13 @@ public class Sns2Configuration implements Cloneable { throw new RuntimeCamelException(e); } } + + /** + * Whether or not the queue is a FIFO topic + */ + boolean isFifoTopic() { + // AWS docs suggest this is valid derivation. + // FIFO topic names must end with .fifo, and standard topic cannot + return topicName.endsWith(".fifo"); + } } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java index 8a7cb30..80b9912 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Constants.java @@ -24,4 +24,5 @@ public interface Sns2Constants { String MESSAGE_ID = "CamelAwsSnsMessageId"; String SUBJECT = "CamelAwsSnsSubject"; String MESSAGE_STRUCTURE = "CamelAwsSnsMessageStructure"; + String MESSAGE_GROUP_ID_PROPERTY = "CamelAwsSnsMessageGroupId"; } diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java index 05db0f1..73aaf91 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Endpoint.java @@ -131,14 +131,20 @@ public class Sns2Endpoint extends DefaultEndpoint implements HeaderFilterStrateg // creates a new topic, or returns the URL of an existing one CreateTopicRequest.Builder builder = CreateTopicRequest.builder().name(configuration.getTopicName()); + Map<String, String> attributes = new HashMap<>(); + if (configuration.isServerSideEncryptionEnabled()) { if (ObjectHelper.isNotEmpty(configuration.getKmsMasterKeyId())) { - Map<String, String> attributes = new HashMap<>(); attributes.put("KmsMasterKeyId", configuration.getKmsMasterKeyId()); builder.attributes(attributes); } } + if (configuration.isFifoTopic()) { + attributes.put("FifoTopic", "true"); + builder.attributes(attributes); + } + LOG.trace("Creating topic [{}] with request [{}]...", configuration.getTopicName(), builder); CreateTopicResponse result = snsClient.createTopic(builder.build()); diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Producer.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Producer.java index 637574e..69b0142 100644 --- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Producer.java +++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Producer.java @@ -61,6 +61,7 @@ public class Sns2Producer extends DefaultProducer { request.messageStructure(determineMessageStructure(exchange)); request.message(exchange.getIn().getBody(String.class)); request.messageAttributes(this.translateAttributes(exchange.getIn().getHeaders(), exchange)); + configureFifoAttributes(request, exchange); LOG.trace("Sending request [{}] from exchange [{}]...", request, exchange); @@ -132,6 +133,21 @@ public class Sns2Producer extends DefaultProducer { return result; } + private void configureFifoAttributes(PublishRequest.Builder request, Exchange exchange) { + if (getEndpoint().getConfiguration().isFifoTopic()) { + // use strategies + MessageGroupIdStrategy messageGroupIdStrategy = getEndpoint().getConfiguration().getMessageGroupIdStrategy(); + String messageGroupId = messageGroupIdStrategy.getMessageGroupId(exchange); + request.messageGroupId(messageGroupId); + + MessageDeduplicationIdStrategy messageDeduplicationIdStrategy + = getEndpoint().getConfiguration().getMessageDeduplicationIdStrategy(); + String messageDeduplicationId = messageDeduplicationIdStrategy.getMessageDeduplicationId(exchange); + request.messageDeduplicationId(messageDeduplicationId); + + } + } + protected Sns2Configuration getConfiguration() { return getEndpoint().getConfiguration(); } diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentFifoIntegrationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentFifoIntegrationTest.java new file mode 100644 index 0000000..2dba900 --- /dev/null +++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/integration/SnsComponentFifoIntegrationTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.aws2.sns.integration; + +import org.apache.camel.Exchange; +import org.apache.camel.ExchangePattern; +import org.apache.camel.Processor; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.aws2.sns.Sns2Constants; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@Disabled("Must be manually tested. Provide your own accessKey and secretKey!") +public class SnsComponentFifoIntegrationTest extends CamelTestSupport { + + @Test + public void sendInOnly() throws Exception { + Exchange exchange = template.send("direct:start", ExchangePattern.InOnly, new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(Sns2Constants.SUBJECT, "This is my subject"); + exchange.getIn().setBody("This is my message text."); + } + }); + + assertNotNull(exchange.getIn().getHeader(Sns2Constants.MESSAGE_ID)); + } + + @Test + public void sendInOut() throws Exception { + Exchange exchange = template.send("direct:start", ExchangePattern.InOut, new Processor() { + public void process(Exchange exchange) throws Exception { + exchange.getIn().setHeader(Sns2Constants.SUBJECT, "This is my subject"); + exchange.getIn().setBody("This is my message text."); + } + }); + + assertNotNull(exchange.getMessage().getHeader(Sns2Constants.MESSAGE_ID)); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .to("aws2-sns://Order.fifo?accessKey=RAW(xxxx)&secretKey=RAW(yyyy)®ion=eu-west-1&subject=The+subject+message&messageGroupIdStrategy=useExchangeId"); + } + }; + } +} diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java index 258a55f..8b8c626 100644 --- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java +++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2SnsComponentBuilderFactory.java @@ -121,6 +121,37 @@ public interface Aws2SnsComponentBuilderFactory { return this; } /** + * Only for FIFO Topic. Strategy for setting the messageDeduplicationId + * on the message. Can be one of the following options: useExchangeId, + * useContentBasedDeduplication. For the useContentBasedDeduplication + * option, no messageDeduplicationId will be set on the message. + * + * The option is a: <code>java.lang.String</code> type. + * + * Default: useExchangeId + * Group: producer + */ + default Aws2SnsComponentBuilder messageDeduplicationIdStrategy( + java.lang.String messageDeduplicationIdStrategy) { + doSetProperty("messageDeduplicationIdStrategy", messageDeduplicationIdStrategy); + return this; + } + /** + * Only for FIFO Topic. Strategy for setting the messageGroupId on the + * message. Can be one of the following options: useConstant, + * useExchangeId, usePropertyValue. For the usePropertyValue option, the + * value of property CamelAwsMessageGroupId will be used. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + */ + default Aws2SnsComponentBuilder messageGroupIdStrategy( + java.lang.String messageGroupIdStrategy) { + doSetProperty("messageGroupIdStrategy", messageGroupIdStrategy); + return this; + } + /** * The message structure to use such as json. * * The option is a: <code>java.lang.String</code> type. @@ -340,6 +371,8 @@ public interface Aws2SnsComponentBuilderFactory { case "configuration": ((Sns2Component) component).setConfiguration((org.apache.camel.component.aws2.sns.Sns2Configuration) value); return true; case "kmsMasterKeyId": getOrCreateConfiguration((Sns2Component) component).setKmsMasterKeyId((java.lang.String) value); return true; case "lazyStartProducer": ((Sns2Component) component).setLazyStartProducer((boolean) value); return true; + case "messageDeduplicationIdStrategy": getOrCreateConfiguration((Sns2Component) component).setMessageDeduplicationIdStrategy((java.lang.String) value); return true; + case "messageGroupIdStrategy": getOrCreateConfiguration((Sns2Component) component).setMessageGroupIdStrategy((java.lang.String) value); return true; case "messageStructure": getOrCreateConfiguration((Sns2Component) component).setMessageStructure((java.lang.String) value); return true; case "policy": getOrCreateConfiguration((Sns2Component) component).setPolicy((java.lang.String) value); return true; case "proxyHost": getOrCreateConfiguration((Sns2Component) component).setProxyHost((java.lang.String) value); return true; diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java index 33a2603..07aa7d3 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Sns2EndpointBuilderFactory.java @@ -166,6 +166,72 @@ public interface Sns2EndpointBuilderFactory { return this; } /** + * Only for FIFO Topic. Strategy for setting the messageDeduplicationId + * on the message. Can be one of the following options: useExchangeId, + * useContentBasedDeduplication. For the useContentBasedDeduplication + * option, no messageDeduplicationId will be set on the message. + * + * The option is a: + * <code>org.apache.camel.component.aws2.sns.MessageDeduplicationIdStrategy</code> type. + * + * Default: useExchangeId + * Group: producer + */ + default Sns2EndpointBuilder messageDeduplicationIdStrategy( + Object messageDeduplicationIdStrategy) { + doSetProperty("messageDeduplicationIdStrategy", messageDeduplicationIdStrategy); + return this; + } + /** + * Only for FIFO Topic. Strategy for setting the messageDeduplicationId + * on the message. Can be one of the following options: useExchangeId, + * useContentBasedDeduplication. For the useContentBasedDeduplication + * option, no messageDeduplicationId will be set on the message. + * + * The option will be converted to a + * <code>org.apache.camel.component.aws2.sns.MessageDeduplicationIdStrategy</code> type. + * + * Default: useExchangeId + * Group: producer + */ + default Sns2EndpointBuilder messageDeduplicationIdStrategy( + String messageDeduplicationIdStrategy) { + doSetProperty("messageDeduplicationIdStrategy", messageDeduplicationIdStrategy); + return this; + } + /** + * Only for FIFO Topic. Strategy for setting the messageGroupId on the + * message. Can be one of the following options: useConstant, + * useExchangeId, usePropertyValue. For the usePropertyValue option, the + * value of property CamelAwsMessageGroupId will be used. + * + * The option is a: + * <code>org.apache.camel.component.aws2.sns.MessageGroupIdStrategy</code> type. + * + * Group: producer + */ + default Sns2EndpointBuilder messageGroupIdStrategy( + Object messageGroupIdStrategy) { + doSetProperty("messageGroupIdStrategy", messageGroupIdStrategy); + return this; + } + /** + * Only for FIFO Topic. Strategy for setting the messageGroupId on the + * message. Can be one of the following options: useConstant, + * useExchangeId, usePropertyValue. For the usePropertyValue option, the + * value of property CamelAwsMessageGroupId will be used. + * + * The option will be converted to a + * <code>org.apache.camel.component.aws2.sns.MessageGroupIdStrategy</code> type. + * + * Group: producer + */ + default Sns2EndpointBuilder messageGroupIdStrategy( + String messageGroupIdStrategy) { + doSetProperty("messageGroupIdStrategy", messageGroupIdStrategy); + return this; + } + /** * The message structure to use such as json. * * The option is a: <code>java.lang.String</code> type. diff --git a/docs/components/modules/ROOT/pages/aws2-sns-component.adoc b/docs/components/modules/ROOT/pages/aws2-sns-component.adoc index cd25819..41d9e18 100644 --- a/docs/components/modules/ROOT/pages/aws2-sns-component.adoc +++ b/docs/components/modules/ROOT/pages/aws2-sns-component.adoc @@ -47,7 +47,7 @@ The topic will be created if they don't already exists. + // component options: START -The AWS 2 Simple Notification System (SNS) component supports 20 options, which are listed below. +The AWS 2 Simple Notification System (SNS) component supports 22 options, which are listed below. @@ -59,6 +59,8 @@ The AWS 2 Simple Notification System (SNS) component supports 20 options, which | *configuration* (producer) | Component configuration | | Sns2Configuration | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String @@ -100,7 +102,7 @@ with the following path and query parameters: |=== -=== Query Parameters (20 parameters): +=== Query Parameters (22 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -111,6 +113,8 @@ with the following path and query parameters: | *headerFilterStrategy* (producer) | To use a custom HeaderFilterStrategy to map headers to/from Camel. | | HeaderFilterStrategy | *kmsMasterKeyId* (producer) | The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK. | | String | *lazyStartProducer* (producer) | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and [...] +| *messageDeduplicationIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageDeduplicationId on the message. Can be one of the following options: useExchangeId, useContentBasedDeduplication. For the useContentBasedDeduplication option, no messageDeduplicationId will be set on the message. There are 2 enums and the value can be one of: useExchangeId, useContentBasedDeduplication | useExchangeId | String +| *messageGroupIdStrategy* (producer) | Only for FIFO Topic. Strategy for setting the messageGroupId on the message. Can be one of the following options: useConstant, useExchangeId, usePropertyValue. For the usePropertyValue option, the value of property CamelAwsMessageGroupId will be used. There are 3 enums and the value can be one of: useConstant, useExchangeId, usePropertyValue | | String | *messageStructure* (producer) | The message structure to use such as json | | String | *policy* (producer) | The policy for this queue | | String | *proxyHost* (producer) | To define a proxy host when instantiating the SNS client | | String