Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS SNS FIFO #96

Merged
merged 4 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions aws-sns-fifo-sink.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: aws-sns-fifo-sink
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8c3ZnICAgdmlld0JveD0iMCAwIDI1NiAyNTciIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiPg0KCTxnPg0KCQk8cGF0aCBkPSJNOTguODc1LDIzMi4wMzMgTDcyLjQ0MiwyMjQuNjI1IEw0Ny40NDEsMTk2LjExNyBMNzguNzEzLDE5NS4yNTQgTDk4Ljg3NSwyMzIuMDMzIiBmaWxsPSIjOTk1QjgwIj48L3BhdGg+DQoJCTxwYXRoIGQ9Ik0zNy43NSwyMTMuMjMzIEwyMi44NzUsMjA5LjA2NyBMOC44MTcsMTkzLjAzMyBMMjUuODk5LDE5MC4yMjQgTDM3Ljc1LDIxMy4yMzMiIGZpbGw9IiM5OTVCODAiPjwvcGF0aD4NCgkJPHBhdGggZD0iTTAsMTkxLjAxNyBMMTUuMjA0LDE5NC4xMDggT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DguOTUiIGZpbGw9IiM3QjNGNjUiPjwvcGF0aD4NCgkJPHBhdGggZD0iTTI1Niw2NC4wMzMgTDEyNy45MjUsMCBMMTI3LjkyNSwyMTYuMzY3IEwxNTAuNTIyLDIxMS44MzkgTDE4MS44MzMsMjU2LjQ5MiBMMjA4LjczNCwyMDAuMTgzIEwyMDguNzE3LDIwMC4xODEgTDI1NiwxOTAuNzA4IEwyNTYsNjQuMDMzIiBmaWxsPSIjQzE3QjlEIj48L3BhdGg+DQoJPC9nPg0KPC9zdmc+DQo="
camel.apache.org/provider: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: sink
camel.apache.org/requires.runtime: "camel-quarkus"
spec:
definition:
title: AWS SNS FIFO Sink
description: Send message to an AWS SQS FIFO Queue
required:
- topicNameOrArn
- accessKey
- secretKey
- region
properties:
topicNameOrArn:
title: Topic Name
description: The SNS Topic name or ARN
type: string
accessKey:
title: Access Key
description: The access key obtained from AWS
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
secretKey:
title: Secret Key
description: The secret key obtained from AWS
type: string
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:password
region:
title: AWS Region
description: The AWS region to connect to
type: string
example: eu-west-1
contentBasedDeduplication:
title: Content-Based Deduplication
description: Use content-based deduplication (should be enabled in the SQS FIFO queue first)
type: boolean
default: false
autoCreateTopic:
title: Autocreate topic
description: Setting the autocreation of the SNS topic.
type: boolean
x-descriptors:
- 'urn:alm:descriptor:com.tectonic.ui:checkbox'
default: false
dependencies:
- camel-quarkus:aws2-sns
flow:
from:
uri: kamelet:source
steps:
- set-property:
name: contentBasedDeduplication
constant: "{{contentBasedDeduplication}}"
- choice:
when:
- simple: "${header[group]}"
steps:
- set-property:
name: CamelAwsSnsMessageGroupId
simple: "${header[group]}"
- simple: "${header[ce-group]}"
steps:
- set-property:
name: CamelAwsSnsMessageGroupId
simple: "${header[ce-group]}"
otherwise:
steps:
- set-property:
name: CamelAwsSnsMessageGroupId
simple: "${exchangeId}"
- choice:
when:
- simple: "${exchangeProperty.contentBasedDeduplication} == 'true'"
steps:
- to:
uri: "aws2-sns:{{topicNameOrArn}}"
parameters:
autoCreateTopic: "{{autoCreateTopic}}"
accessKey: "{{accessKey}}"
secretKey: "{{secretKey}}"
region: "{{region}}"
messageGroupIdStrategy: "usePropertyValue"
messageDeduplicationIdStrategy: "useContentBasedDeduplication"
otherwise:
steps:
- to:
uri: "aws2-sns:{{topicNameOrArn}}"
parameters:
autoCreateTopic: "{{autoCreateTopic}}"
accessKey: "{{accessKey}}"
secretKey: "{{secretKey}}"
region: "{{region}}"
messageGroupIdStrategy: "usePropertyValue"
messageDeduplicationIdStrategy: "useExchangeId"
14 changes: 14 additions & 0 deletions docs/modules/ROOT/assets/images/kamelets/aws-sns-fifo-sink.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* xref:ROOT:aws-ddb-streams-source.adoc[image:kamelets/aws-ddb-streams-source.svg[] AWS DynamoDB Streams Source]
* xref:ROOT:aws-kinesis-source.adoc[image:kamelets/aws-kinesis-source.svg[] AWS Kinesis Source]
* xref:ROOT:aws-s3-source.adoc[image:kamelets/aws-s3-source.svg[] AWS S3 Source]
* xref:ROOT:aws-sns-fifo-sink.adoc[image:kamelets/aws-sns-fifo-sink.svg[] AWS SNS FIFO Sink]
* xref:ROOT:aws-sns-sink.adoc[image:kamelets/aws-sns-sink.svg[] AWS SNS Sink]
* xref:ROOT:aws-sqs-fifo-sink.adoc[image:kamelets/aws-sqs-fifo-sink.svg[] AWS SQS FIFO Sink]
* xref:ROOT:aws-sqs-sink.adoc[image:kamelets/aws-sqs-sink.svg[] AWS SQS Sink]
Expand Down
68 changes: 68 additions & 0 deletions docs/modules/ROOT/pages/aws-sns-fifo-sink.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/aws-sns-fifo-sink.svg[] AWS SNS FIFO Sink

*Provided by: "Apache Software Foundation"*

Send message to an AWS SQS FIFO Queue

== Configuration Options

The following table summarizes the configuration options available for the `aws-sns-fifo-sink` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessKey {empty}* *| Access Key| The access key obtained from AWS| string| |
| *region {empty}* *| AWS Region| The AWS region to connect to| string| | `"eu-west-1"`
| *secretKey {empty}* *| Secret Key| The secret key obtained from AWS| string| |
| *topicNameOrArn {empty}* *| Topic Name| The SNS Topic name or ARN| string| |
| autoCreateTopic| Autocreate topic| Setting the autocreation of the SNS topic.| boolean| `false`|
| contentBasedDeduplication| Content-Based Deduplication| Use content-based deduplication (should be enabled in the SQS FIFO queue first)| boolean| `false`|
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `aws-sns-fifo-sink` can be used in various contexts.

=== Knative Sink

The `aws-sns-fifo-sink` Kamelet can be used as Knative sink by binding it to a Knative object.

.aws-sns-fifo-sink-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: aws-sns-fifo-sink-binding
spec:
source:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: aws-sns-fifo-sink
properties:
accessKey: "The Access Key"
region: "eu-west-1"
secretKey: "The Secret Key"
topicNameOrArn: "The Topic Name"

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `aws-sns-fifo-sink-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the sink using the following command:

[source,shell]
----
kubectl apply -f aws-sns-fifo-sink-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT