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-kamelets.git
commit 8e42ac0a2301482b35c5ca0d351d43084bdedf73 Author: nicolaferraro <[email protected]> AuthorDate: Mon Mar 22 17:08:03 2021 +0100 use dynamic strategy for groups and dedup --- aws-sqs-fifo-sink.kamelet.yaml | 67 +++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/aws-sqs-fifo-sink.kamelet.yaml b/aws-sqs-fifo-sink.kamelet.yaml index 2330de6..2c2654f 100644 --- a/aws-sqs-fifo-sink.kamelet.yaml +++ b/aws-sqs-fifo-sink.kamelet.yaml @@ -16,8 +16,6 @@ spec: - accessKey - secretKey - region - - messageGroupIdStrategy - - messageDeduplicationIdStrategy properties: queueNameOrArn: title: Queue Name @@ -40,25 +38,54 @@ spec: description: The AWS region to connect to type: string example: eu-west-1 - messageGroupIdStrategy: - title: Message Group ID Strategy - description: Strategy for setting the messageGroupId on the message. Can be one of the following options useConstant, useExchangeId, usePropertyValue. - type: string - default: useExchangeId - messageDeduplicationIdStrategy: - title: Message Deduplication ID Strategy - description: Strategy for setting the messageDeduplicationId on the message. Can be one of the following options useExchangeId, useContentBasedDeduplication - type: string - default: useExchangeId + contentBasedDeduplication: + title: Content-Based Deduplication + description: Use content-based deduplication (should be enabled in the SQS FIFO queue first) + type: boolean + default: false flow: from: uri: kamelet:source steps: - - to: - uri: "aws2-sqs:{{queueNameOrArn}}" - parameters: - accessKey: "{{accessKey}}" - secretKey: "{{secretKey}}" - region: "{{region}}" - messageGroupIdStrategy: "{{messageGroupIdStrategy}}" - messageDeduplicationIdStrategy: "{{messageDeduplicationIdStrategy}}" + - set-property: + name: contentBasedDeduplication + constant: "{{contentBasedDeduplication}}" + - choice: + when: + - simple: "${header[group]}" + steps: + - set-property: + name: CamelAwsMessageGroupId + simple: "${header[group]}" + - simple: "${header[ce-group]}" + steps: + - set-property: + name: CamelAwsMessageGroupId + simple: "${header[ce-group]}" + otherwise: + steps: + - set-property: + name: CamelAwsMessageGroupId + simple: "${exchangeId}" + - choice: + when: + - simple: "${exchangeProperty.contentBasedDeduplication} == 'true'" + steps: + - to: + uri: "aws2-sqs:{{queueNameOrArn}}" + parameters: + accessKey: "{{accessKey}}" + secretKey: "{{secretKey}}" + region: "{{region}}" + messageGroupIdStrategy: "usePropertyValue" + messageDeduplicationIdStrategy: "useContentBasedDeduplication" + otherwise: + steps: + - to: + uri: "aws2-sqs:{{queueNameOrArn}}" + parameters: + accessKey: "{{accessKey}}" + secretKey: "{{secretKey}}" + region: "{{region}}" + messageGroupIdStrategy: "usePropertyValue" + messageDeduplicationIdStrategy: "useExchangeId"
