Skip to content

Instantly share code, notes, and snippets.

@oscerd
Created October 14, 2022 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscerd/86df5113421f8fa8e3e5fe6a491279bd to your computer and use it in GitHub Desktop.
Save oscerd/86df5113421f8fa8e3e5fe6a491279bd to your computer and use it in GitHub Desktop.
# ---------------------------------------------------------------------------
# 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.
# ------------------------------------------------------------------------------
apiVersion: "camel.apache.org/v1alpha1"
kind: "Kamelet"
metadata:
annotations:
camel.apache.org/kamelet.support.level: "Stable"
camel.apache.org/catalog.version: "main-SNAPSHOT"
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5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bGw9IiM2MjRhMWUiCiAgICAgICAgIHBvaW50cz0iNzkuODIzLDM3LjM1IDU0LjQ4MSw0MC40OTYgMjMuOTg3LDM2LjIwMSA1MC4wMDMsMjguMzk5ICIKICAgICAgICAgaWQ9InBvbHlnb24xMzYiIC8+PHBvbHlnb24KICAgICAgICAgZmlsbD0iI2ZhZDc5MSIKICAgICAgICAgcG9pbnRzPSI3OS44MDYsNjIuNjYgNTQuNDYsNTkuNTA2IDIzLjk4NSw2My43OTMgNDkuOTk5LDcxLjYgIgogICAgICAgICBpZD0icG9seWdvbjEzOCIgLz48cG9seWdvbgogICAgICAgICBmaWxsPSIjZDlhNzQxIgogICAgICAgICBwb2ludHM9IjUwLjAwMSw0MC44MzIgNzkuODA4LDQ0LjYyOSA3OS44MDgsNTUuMzMgNDkuOTk5LDU5LjA5MiAiCiAgICAgICAgIGlkPSJwb2x5Z29uMTQwIiAvPjwvZz48L2c+PC9zdmc+Cg=="
camel.apache.org/provider: "Apache Software Foundation"
camel.apache.org/kamelet.group: "AWS SQS"
camel.apache.org/keda.type: "aws-sqs-queue"
labels:
camel.apache.org/kamelet.type: "source"
name: "aws-sqs-source"
Headers:
CamelAwsSqsPrefix: "A string to use for filtering the list results."
CamelAwsSqsReceiptHandle: "The Amazon SQS message receipt handle."
CamelAwsSqsMessageId: "The Amazon SQS message ID."
CamelAwsSqsMessageAttributes: "The Amazon SQS message attributes."
CamelAwsSqsMD5OfBody: "The MD5 checksum of the Amazon SQS message."
CamelAwsSqsAttributes: "A map of the attributes requested in ReceiveMessage to their respective values."
CamelAwsSqsDelaySeconds: "The delay seconds that the Amazon SQS message can be see by others."
CamelAwsSqsOperation: "The operation we want to perform"
spec:
definition:
description: "Receive data from AWS SQS.\n\nAccess Key/Secret Key are the basic method for authenticating to the AWS SQS Service. These parameters are optional because the Kamelet provides the 'useDefaultCredentialsProvider'.\n\nWhen using a default Credentials Provider the SQS client will load the credentials through this provider and won't use the static credential. This is reason for not having the access key and secret key as mandatory parameter for this Kamelet.\n\nTwo headers will be duplicated with different names for clarity at sink level, CamelAwsSqsMessageId will be duplicated into aws.sqs.message.id and CamelAwsSqsReceiptHandle will be duplicated in aws.sqs.receipt.handle"
properties:
queueNameOrArn:
description: "The SQS Queue Name or ARN"
title: "Queue Name"
type: "string"
deleteAfterRead:
default: true
description: "Delete messages after consuming them"
title: "Auto-delete Messages"
type: "boolean"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:checkbox"
accessKey:
description: "The access key obtained from AWS."
format: "password"
title: "Access Key"
type: "string"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:password"
- "urn:camel:group:credentials"
- "urn:keda:authentication:awsAccessKeyID"
- "urn:keda:required"
secretKey:
description: "The secret key obtained from AWS."
format: "password"
title: "Secret Key"
type: "string"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:password"
- "urn:camel:group:credentials"
- "urn:keda:authentication:awsSecretAccessKey"
- "urn:keda:required"
region:
description: "The AWS region to access."
enum:
- "ap-south-1"
- "eu-south-1"
- "us-gov-east-1"
- "me-central-1"
- "ca-central-1"
- "eu-central-1"
- "us-iso-west-1"
- "us-west-1"
- "us-west-2"
- "af-south-1"
- "eu-north-1"
- "eu-west-3"
- "eu-west-2"
- "eu-west-1"
- "ap-northeast-3"
- "ap-northeast-2"
- "ap-northeast-1"
- "me-south-1"
- "sa-east-1"
- "ap-east-1"
- "cn-north-1"
- "us-gov-west-1"
- "ap-southeast-1"
- "ap-southeast-2"
- "us-iso-east-1"
- "ap-southeast-3"
- "us-east-1"
- "us-east-2"
- "cn-northwest-1"
- "us-isob-east-1"
- "aws-global"
- "aws-cn-global"
- "aws-us-gov-global"
- "aws-iso-global"
- "aws-iso-b-global"
title: "AWS Region"
type: "string"
x-descriptors:
- "urn:keda:metadata:awsRegion"
- "urn:keda:required"
autoCreateQueue:
default: false
description: "Setting the autocreation of the SQS queue."
title: "Autocreate Queue"
type: "boolean"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:checkbox"
amazonAWSHost:
default: "amazonaws.com"
description: "The hostname of the Amazon AWS cloud."
title: "AWS Host"
type: "string"
protocol:
default: "https"
description: "The underlying protocol used to communicate with SQS"
example: "http or https"
title: "Protocol"
type: "string"
queueURL:
description: "The full SQS Queue URL (required if using KEDA)"
title: "Queue URL"
type: "string"
x-descriptors:
- "urn:keda:metadata:queueURL"
- "urn:keda:required"
useDefaultCredentialsProvider:
default: false
description: "If true, the SQS client loads credentials through a default credentials provider. If false, it uses the basic authentication method (access key and secret key)."
title: "Default Credentials Provider"
type: "boolean"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:checkbox"
uriEndpointOverride:
description: "The overriding endpoint URI. To use this option, you must also select the `overrideEndpoint` option."
title: "Overwrite Endpoint URI"
type: "string"
overrideEndpoint:
default: false
description: "Select this option to override the endpoint URI. To use this option, you must also provide a URI for the `uriEndpointOverride` option."
title: "Endpoint Overwrite"
type: "boolean"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:checkbox"
delay:
default: 500
description: "The number of milliseconds before the next poll of the selected stream"
title: "Delay"
type: "integer"
greedy:
default: false
description: "If greedy is enabled, then the polling will happen immediately again, if the previous run polled 1 or more messages."
title: "Greedy Scheduler"
type: "boolean"
x-descriptors:
- "urn:alm:descriptor:com.tectonic.ui:checkbox"
required:
- "queueNameOrArn"
- "region"
title: "AWS SQS Source"
type: "object"
dependencies:
- "camel:core"
- "camel:aws2-sqs"
- "github:apache.camel-kamelets:camel-kamelets-utils:main-SNAPSHOT"
- "camel:kamelet"
template:
beans:
-
name: "renameHeaders"
type: "#class:org.apache.camel.kamelets.utils.headers.DuplicateNamingHeaders"
property:
-
key: "prefix"
value: "CamelAwsSqs"
-
key: "renamingPrefix"
value: "aws.sqs."
-
key: "mode"
value: "filtering"
-
key: "selectedHeaders"
value: "CamelAwsSqsReceiptHandle,CamelAwsSqsMessageId"
from:
uri: "aws2-sqs:{{queueNameOrArn}}"
parameters:
autoCreateQueue: "{{autoCreateQueue}}"
secretKey: "{{?secretKey}}"
accessKey: "{{?accessKey}}"
region: "{{region}}"
deleteAfterRead: "{{deleteAfterRead}}"
amazonAWSHost: "{{?amazonAWSHost}}"
protocol: "{{?protocol}}"
useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
uriEndpointOverride: "{{?uriEndpointOverride}}"
overrideEndpoint: "{{overrideEndpoint}}"
delay: "{{delay}}"
greedy: "{{greedy}}"
steps:
-
process:
ref: "{{renameHeaders}}"
-
to: "kamelet:sink"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment