This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new d35c2b47e Fix #3334: new aws-eventbridge-source Kamelet, the events of
an EventBridge rule through an SQS queue (#3338)
d35c2b47e is described below
commit d35c2b47e74074d27bee26166065e5b2aa0a3345
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 03:24:21 2026 +0100
Fix #3334: new aws-eventbridge-source Kamelet, the events of an EventBridge
rule through an SQS queue (#3338)
* Fix #3334: new aws-eventbridge-source Kamelet, the events of an
EventBridge rule through an SQS queue
The pair of aws-eventbridge-sink, on the consumer of the aws2-eventbridge
component: it adds an SQS
queue to an existing rule as a target and polls it. Without queueURL the
queue is created on start and
removed from the rule and deleted on stop; with queueURL the target stays.
The body is the whole
EventBridge event as JSON text, with the SQS message ID and receipt handle
as headers.
A Citrus test against Floci puts a non-matching and a matching event on a
bus with aws-eventbridge-sink
and checks that only the matching one arrives, with its body and headers.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: regenerate the catalog files after merging main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 10 +-
docs/modules/ROOT/nav.adoc | 1 +
kamelets/aws-eventbridge-source.kamelet.yaml | 212 +++++++++++++++++++++
.../kamelets/catalog/KameletsCatalogTest.java | 2 +-
.../main/resources/META-INF/kamelets-index.json | 10 +
.../kamelets/aws-eventbridge-source.kamelet.yaml | 212 +++++++++++++++++++++
.../eventbridge/aws-eventbridge-source-route.yaml | 90 +++++++++
.../aws-eventbridge-source.citrus.it.yaml | 96 ++++++++++
.../aws/eventbridge/setupEventBridgeRule.groovy | 37 ++++
9 files changed, 668 insertions(+), 2 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index e00a5fb4b..70b58c47a 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -71,6 +71,11 @@
"type" : "library",
"name" : "aws-eventbridge-sink",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:aws-eventbridge-source",
+ "type" : "library",
+ "name" : "aws-eventbridge-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:aws-kinesis-firehose-sink",
"type" : "library",
@@ -2340,7 +2345,7 @@
} ],
"dependencies" : [ {
"ref" : "camel-kamelets-catalog",
- "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-kinesis-firehose-sink",
"kamelet:aws-kinesis-sink", "kamelet:aws-kinesis- [...]
+ "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source",
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
}, {
"ref" : "kamelet:avro-deserialize-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2377,6 +2382,9 @@
}, {
"ref" : "kamelet:aws-eventbridge-sink",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:aws-eventbridge-source",
+ "dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:aws-kinesis-firehose-sink",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index 8807e2def..1d4ce7158 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -11,6 +11,7 @@
* xref:aws-ddb-streams-source.adoc[]
* xref:aws-ec2-sink.adoc[]
* xref:aws-eventbridge-sink.adoc[]
+* xref:aws-eventbridge-source.adoc[]
* xref:aws-kinesis-firehose-sink.adoc[]
* xref:aws-kinesis-sink.adoc[]
* xref:aws-kinesis-source.adoc[]
diff --git a/kamelets/aws-eventbridge-source.kamelet.yaml
b/kamelets/aws-eventbridge-source.kamelet.yaml
new file mode 100644
index 000000000..cb014da2f
--- /dev/null
+++ b/kamelets/aws-eventbridge-source.kamelet.yaml
@@ -0,0 +1,212 @@
+# ---------------------------------------------------------------------------
+# 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/v1
+kind: Kamelet
+metadata:
+ name: aws-eventbridge-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI1NiAyNTYiIHN0eWxlPSItbXMtdHJhbnNmb3JtOiByb3RhdGUoMzYwZGVnKTsgLXdlYmtpdC10cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyB0cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJJY29uaWZ5SWQtMTgyM2Y2NTU1NjktYWYxZGQ1LT
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "AWS Eventbridge"
+ camel.apache.org/kamelet.namespace: "AWS"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "AWS Eventbridge Source"
+ description: |-
+ Receives the events that an Amazon EventBridge rule matches on an event
bus, one message per event, through an SQS queue that it adds to the rule as a
target.
+
+ Use it to react to the events of your applications or of AWS services,
such as `Order Shipped` from a shop or a change of state of an EC2 instance,
without setting up a queue yourself. To publish events, use
`aws-eventbridge-sink`. For the events of an S3 bucket,
`aws-s3-event-based-source` reads a queue that you made the target of a rule
yourself, gives each event an ID that is the same in its copies, and can fetch
the files.
+
+ Output: the body is the whole EventBridge event, as JSON text: `id` (the
ID that EventBridge gave the event), `detail-type`, `source`, `account`,
`time`, `region`, `resources` and `detail`, which holds what the sender of the
event put in it, such as `{"orderId": "A-1"}`. The
`CamelAwsEventbridgeMessageId` header is the ID of the SQS message that carried
the event, and `CamelAwsEventbridgeReceiptHandle` its receipt handle.
+
+ Good to know: the rule must exist on the event bus before the Kamelet
starts, or it fails to start; its event pattern decides which events arrive.
Create it in the EventBridge console or with `aws events put-rule`. Without
`queueURL`, it creates a queue named `camel-eventbridge-` followed by the rule
name and a random part, and adds it to the rule; when it stops, it removes the
queue from the rule and deletes it, so the events of the time it does not run
are lost, and each replica [...]
+ required:
+ - eventbusNameOrArn
+ - ruleName
+ - region
+ type: object
+ properties:
+ eventbusNameOrArn:
+ title: Event Bus Name
+ description: The name of the event bus of the rule, such as `default`
or `orders`, or its ARN (Amazon Resource Name).
+ example: orders
+ type: string
+ ruleName:
+ title: Rule Name
+ description: The name of the EventBridge rule whose events to receive,
such as `orders-shipped`. The rule must exist on the event bus; its event
pattern decides which events arrive.
+ example: orders-shipped
+ type: string
+ pattern: "^[.\\-_A-Za-z0-9]+$"
+ queueURL:
+ title: Queue URL
+ description: The full address of an SQS queue of your own to receive
the events through, as the SQS console shows it. Its access policy must let
EventBridge (`events.amazonaws.com`) send messages to it. It stays a target of
the rule when the Kamelet stops. When it is not set, a queue is created when
the Kamelet starts and deleted when it stops.
+ example: https://sqs.eu-west-1.amazonaws.com/123456789012/orders-events
+ type: string
+ accessKey:
+ title: Access Key
+ description: The access key ID of an IAM user, which you create in the
AWS console under IAM, Users, Security credentials. Use it together with
`secretKey`. Leave both out when `useDefaultCredentialsProvider` or
`useProfileCredentialsProvider` is true.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ secretKey:
+ title: Secret Key
+ description: The secret access key that belongs to `accessKey`. The
AWS console shows it only once, when the access key is created.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ region:
+ title: AWS Region
+ description: The AWS region of the event bus and the queue, as a
region code such as `eu-west-1` or `us-east-1`.
+ example: eu-west-1
+ type: string
+ 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", "a [...]
+ useDefaultCredentialsProvider:
+ title: Default Credentials Provider
+ description: "If true, the credentials are found in the environment
instead of in `accessKey` and `secretKey`: the `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` environment variables, the `~/.aws/credentials` file,
or the IAM role of the EC2 instance, ECS task or Kubernetes pod the integration
runs on."
+ type: boolean
+ default: false
+ useProfileCredentialsProvider:
+ title: Profile Credentials Provider
+ description: If true, the credentials are read from a named profile in
the AWS credentials file (`~/.aws/credentials`), as the AWS CLI does. Name the
profile in `profileCredentialsName`.
+ type: boolean
+ default: false
+ useSessionCredentials:
+ title: Session Credentials
+ description: "If true, it logs in with temporary credentials:
`accessKey`, `secretKey` and `sessionToken`, such as the ones AWS STS gives
when you assume an IAM role."
+ type: boolean
+ default: false
+ profileCredentialsName:
+ title: Profile Credentials Name
+ description: The name of the profile in the AWS credentials file. Only
used when `useProfileCredentialsProvider` is true; when it is not set, the
default profile is used.
+ example: production
+ type: string
+ pattern: "^[A-Za-z0-9_.@-]+$"
+ sessionToken:
+ title: Session Token
+ description: The session token of temporary credentials, which comes
with their access key and secret key, for example from AWS STS when you assume
an IAM role. Only used when `useSessionCredentials` is true.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ uriEndpointOverride:
+ title: Overwrite Endpoint URI
+ description: The address to connect to instead of AWS, for EventBridge
and SQS, as a URL such as `http://localhost:4566` for LocalStack. Only used
when `overrideEndpoint` is true.
+ example: http://localhost:4566
+ type: string
+ overrideEndpoint:
+ title: Endpoint Overwrite
+ description: If true, it connects to the address in
`uriEndpointOverride` instead of to AWS. Use it for a local stand-in of AWS
such as LocalStack.
+ type: boolean
+ default: false
+ delay:
+ title: Delay
+ description: How long to wait between two polls of the queue, in
milliseconds.
+ type: integer
+ default: 500
+ greedy:
+ title: Greedy Scheduler
+ description: If true, it polls again right away when the last poll
received events, instead of waiting for `delay`.
+ type: boolean
+ default: false
+ maxMessagesPerPoll:
+ title: Max Events Per Poll
+ description: The most events to receive in one request to SQS, from 1
to 10. SQS may return fewer.
+ type: integer
+ minimum: "1"
+ maximum: "10"
+ default: 10
+ waitTimeSeconds:
+ title: Wait Time
+ description: How long one request waits for an event to arrive when
the queue is empty, in seconds, from 0 to 20 (long polling). It saves requests,
and so cost, when events are rare.
+ type: integer
+ minimum: "0"
+ maximum: "20"
+ default: 20
+ visibilityTimeout:
+ title: Visibility Timeout
+ description: How long a received event stays hidden from other readers
of the queue, in seconds. If it has not been processed by then, it is received
again. Set it longer than processing one event takes.
+ type: integer
+ minimum: "0"
+ default: 30
+ proxyHost:
+ title: Proxy Host
+ description: The host name or IP address of an HTTP proxy to send the
calls to AWS through, such as the proxy of a company network. Used only
together with `proxyPort`. When it is not set, the calls go straight to AWS.
+ type: string
+ pattern: "^[A-Za-z0-9._-]+$"
+ example: proxy.example.com
+ proxyPort:
+ title: Proxy Port
+ description: The port of the proxy in `proxyHost`, such as `3128` for
Squid. Used only together with `proxyHost`.
+ type: integer
+ example: 3128
+ proxyProtocol:
+ title: Proxy Protocol
+ description: "How to talk to the proxy itself: `HTTP` or `HTTPS`. It
is not the protocol of the calls to AWS, which stay encrypted, as the proxy
only passes them on. When it is not set, it is `HTTPS`, which needs a proxy
that takes TLS connections. Most company proxies, such as Squid, take plain
HTTP: set `HTTP` for them. With the wrong one, every call fails, for example
with `Unsupported or unrecognized SSL message`."
+ type: string
+ enum: ["HTTP", "HTTPS"]
+ example: HTTP
+ dataTypes:
+ # No 'default:' here on purpose: the out default of a source runs after
the steps that follow
+ # the Kamelet (see #3117). The body is the EventBridge event as JSON text.
+ out:
+ headers:
+ CamelAwsEventbridgeMessageId:
+ title: SQS Message ID
+ description: The ID of the SQS message that carried the event.
+ type: string
+ CamelAwsEventbridgeReceiptHandle:
+ title: Receipt Handle
+ description: The receipt handle of the SQS message, which SQS needs
to delete the message from the queue.
+ type: string
+ dependencies:
+ - "camel:aws2-eventbridge"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: "aws2-eventbridge:{{eventbusNameOrArn}}"
+ parameters:
+ ruleName: "{{ruleName}}"
+ queueUrl: "{{?queueURL}}"
+ accessKey: "RAW({{?accessKey}})"
+ secretKey: "RAW({{?secretKey}})"
+ region: "{{region}}"
+ useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
+ useProfileCredentialsProvider: "{{useProfileCredentialsProvider}}"
+ profileCredentialsName: "{{?profileCredentialsName}}"
+ useSessionCredentials: "{{useSessionCredentials}}"
+ sessionToken: "RAW({{?sessionToken}})"
+ uriEndpointOverride: "{{?uriEndpointOverride}}"
+ overrideEndpoint: "{{overrideEndpoint}}"
+ delay: "{{delay}}"
+ greedy: "{{greedy}}"
+ maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
+ waitTimeSeconds: "{{waitTimeSeconds}}"
+ visibilityTimeout: "{{visibilityTimeout}}"
+ proxyHost: "{{?proxyHost}}"
+ proxyPort: "{{?proxyPort}}"
+ proxyProtocol: "{{?proxyProtocol}}"
+ steps:
+ - to:
+ uri: kamelet:sink
diff --git
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
index d2c6f0c34..d4207b4ec 100644
---
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
+++
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
@@ -147,7 +147,7 @@ public class KameletsCatalogTest {
void testGetKameletsByNamespace() throws Exception {
List<Kamelet> c = catalog.getKameletsByNamespace("AWS");
assertFalse(c.isEmpty());
- assertEquals(31, c.size());
+ assertEquals(32, c.size());
c = catalog.getKameletsByGroups("Not-existing-group");
assertTrue(c.isEmpty());
}
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 7150c3da6..c40432e1c 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -119,6 +119,16 @@
"group" : "AWS Eventbridge",
"namespace" : "AWS",
"provider" : "Apache Software Foundation"
+ }, {
+ "name" : "aws-eventbridge-source",
+ "type" : "source",
+ "supportLevel" : "Stable",
+ "title" : "AWS Eventbridge Source",
+ "summary" : "Receives the events that an Amazon EventBridge rule matches
on an event bus, one message per event, through an SQS queue that it adds to
the rule as a target.",
+ "description" : "Receives the events that an Amazon EventBridge rule
matches on an event bus, one message per event, through an SQS queue that it
adds to the rule as a target.\n\nUse it to react to the events of your
applications or of AWS services, such as `Order Shipped` from a shop or a
change of state of an EC2 instance, without setting up a queue yourself. To
publish events, use `aws-eventbridge-sink`. For the events of an S3 bucket,
`aws-s3-event-based-source` reads a queue tha [...]
+ "group" : "AWS Eventbridge",
+ "namespace" : "AWS",
+ "provider" : "Apache Software Foundation"
}, {
"name" : "aws-kinesis-firehose-sink",
"type" : "sink",
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/aws-eventbridge-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/aws-eventbridge-source.kamelet.yaml
new file mode 100644
index 000000000..cb014da2f
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/aws-eventbridge-source.kamelet.yaml
@@ -0,0 +1,212 @@
+# ---------------------------------------------------------------------------
+# 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/v1
+kind: Kamelet
+metadata:
+ name: aws-eventbridge-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMWVtIiBoZWlnaHQ9IjFlbSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDI1NiAyNTYiIHN0eWxlPSItbXMtdHJhbnNmb3JtOiByb3RhdGUoMzYwZGVnKTsgLXdlYmtpdC10cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyB0cmFuc2Zvcm06IHJvdGF0ZSgzNjBkZWcpOyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJJY29uaWZ5SWQtMTgyM2Y2NTU1NjktYWYxZGQ1LT
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "AWS Eventbridge"
+ camel.apache.org/kamelet.namespace: "AWS"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+spec:
+ definition:
+ title: "AWS Eventbridge Source"
+ description: |-
+ Receives the events that an Amazon EventBridge rule matches on an event
bus, one message per event, through an SQS queue that it adds to the rule as a
target.
+
+ Use it to react to the events of your applications or of AWS services,
such as `Order Shipped` from a shop or a change of state of an EC2 instance,
without setting up a queue yourself. To publish events, use
`aws-eventbridge-sink`. For the events of an S3 bucket,
`aws-s3-event-based-source` reads a queue that you made the target of a rule
yourself, gives each event an ID that is the same in its copies, and can fetch
the files.
+
+ Output: the body is the whole EventBridge event, as JSON text: `id` (the
ID that EventBridge gave the event), `detail-type`, `source`, `account`,
`time`, `region`, `resources` and `detail`, which holds what the sender of the
event put in it, such as `{"orderId": "A-1"}`. The
`CamelAwsEventbridgeMessageId` header is the ID of the SQS message that carried
the event, and `CamelAwsEventbridgeReceiptHandle` its receipt handle.
+
+ Good to know: the rule must exist on the event bus before the Kamelet
starts, or it fails to start; its event pattern decides which events arrive.
Create it in the EventBridge console or with `aws events put-rule`. Without
`queueURL`, it creates a queue named `camel-eventbridge-` followed by the rule
name and a random part, and adds it to the rule; when it stops, it removes the
queue from the rule and deletes it, so the events of the time it does not run
are lost, and each replica [...]
+ required:
+ - eventbusNameOrArn
+ - ruleName
+ - region
+ type: object
+ properties:
+ eventbusNameOrArn:
+ title: Event Bus Name
+ description: The name of the event bus of the rule, such as `default`
or `orders`, or its ARN (Amazon Resource Name).
+ example: orders
+ type: string
+ ruleName:
+ title: Rule Name
+ description: The name of the EventBridge rule whose events to receive,
such as `orders-shipped`. The rule must exist on the event bus; its event
pattern decides which events arrive.
+ example: orders-shipped
+ type: string
+ pattern: "^[.\\-_A-Za-z0-9]+$"
+ queueURL:
+ title: Queue URL
+ description: The full address of an SQS queue of your own to receive
the events through, as the SQS console shows it. Its access policy must let
EventBridge (`events.amazonaws.com`) send messages to it. It stays a target of
the rule when the Kamelet stops. When it is not set, a queue is created when
the Kamelet starts and deleted when it stops.
+ example: https://sqs.eu-west-1.amazonaws.com/123456789012/orders-events
+ type: string
+ accessKey:
+ title: Access Key
+ description: The access key ID of an IAM user, which you create in the
AWS console under IAM, Users, Security credentials. Use it together with
`secretKey`. Leave both out when `useDefaultCredentialsProvider` or
`useProfileCredentialsProvider` is true.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ secretKey:
+ title: Secret Key
+ description: The secret access key that belongs to `accessKey`. The
AWS console shows it only once, when the access key is created.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ region:
+ title: AWS Region
+ description: The AWS region of the event bus and the queue, as a
region code such as `eu-west-1` or `us-east-1`.
+ example: eu-west-1
+ type: string
+ 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", "a [...]
+ useDefaultCredentialsProvider:
+ title: Default Credentials Provider
+ description: "If true, the credentials are found in the environment
instead of in `accessKey` and `secretKey`: the `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` environment variables, the `~/.aws/credentials` file,
or the IAM role of the EC2 instance, ECS task or Kubernetes pod the integration
runs on."
+ type: boolean
+ default: false
+ useProfileCredentialsProvider:
+ title: Profile Credentials Provider
+ description: If true, the credentials are read from a named profile in
the AWS credentials file (`~/.aws/credentials`), as the AWS CLI does. Name the
profile in `profileCredentialsName`.
+ type: boolean
+ default: false
+ useSessionCredentials:
+ title: Session Credentials
+ description: "If true, it logs in with temporary credentials:
`accessKey`, `secretKey` and `sessionToken`, such as the ones AWS STS gives
when you assume an IAM role."
+ type: boolean
+ default: false
+ profileCredentialsName:
+ title: Profile Credentials Name
+ description: The name of the profile in the AWS credentials file. Only
used when `useProfileCredentialsProvider` is true; when it is not set, the
default profile is used.
+ example: production
+ type: string
+ pattern: "^[A-Za-z0-9_.@-]+$"
+ sessionToken:
+ title: Session Token
+ description: The session token of temporary credentials, which comes
with their access key and secret key, for example from AWS STS when you assume
an IAM role. Only used when `useSessionCredentials` is true.
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ uriEndpointOverride:
+ title: Overwrite Endpoint URI
+ description: The address to connect to instead of AWS, for EventBridge
and SQS, as a URL such as `http://localhost:4566` for LocalStack. Only used
when `overrideEndpoint` is true.
+ example: http://localhost:4566
+ type: string
+ overrideEndpoint:
+ title: Endpoint Overwrite
+ description: If true, it connects to the address in
`uriEndpointOverride` instead of to AWS. Use it for a local stand-in of AWS
such as LocalStack.
+ type: boolean
+ default: false
+ delay:
+ title: Delay
+ description: How long to wait between two polls of the queue, in
milliseconds.
+ type: integer
+ default: 500
+ greedy:
+ title: Greedy Scheduler
+ description: If true, it polls again right away when the last poll
received events, instead of waiting for `delay`.
+ type: boolean
+ default: false
+ maxMessagesPerPoll:
+ title: Max Events Per Poll
+ description: The most events to receive in one request to SQS, from 1
to 10. SQS may return fewer.
+ type: integer
+ minimum: "1"
+ maximum: "10"
+ default: 10
+ waitTimeSeconds:
+ title: Wait Time
+ description: How long one request waits for an event to arrive when
the queue is empty, in seconds, from 0 to 20 (long polling). It saves requests,
and so cost, when events are rare.
+ type: integer
+ minimum: "0"
+ maximum: "20"
+ default: 20
+ visibilityTimeout:
+ title: Visibility Timeout
+ description: How long a received event stays hidden from other readers
of the queue, in seconds. If it has not been processed by then, it is received
again. Set it longer than processing one event takes.
+ type: integer
+ minimum: "0"
+ default: 30
+ proxyHost:
+ title: Proxy Host
+ description: The host name or IP address of an HTTP proxy to send the
calls to AWS through, such as the proxy of a company network. Used only
together with `proxyPort`. When it is not set, the calls go straight to AWS.
+ type: string
+ pattern: "^[A-Za-z0-9._-]+$"
+ example: proxy.example.com
+ proxyPort:
+ title: Proxy Port
+ description: The port of the proxy in `proxyHost`, such as `3128` for
Squid. Used only together with `proxyHost`.
+ type: integer
+ example: 3128
+ proxyProtocol:
+ title: Proxy Protocol
+ description: "How to talk to the proxy itself: `HTTP` or `HTTPS`. It
is not the protocol of the calls to AWS, which stay encrypted, as the proxy
only passes them on. When it is not set, it is `HTTPS`, which needs a proxy
that takes TLS connections. Most company proxies, such as Squid, take plain
HTTP: set `HTTP` for them. With the wrong one, every call fails, for example
with `Unsupported or unrecognized SSL message`."
+ type: string
+ enum: ["HTTP", "HTTPS"]
+ example: HTTP
+ dataTypes:
+ # No 'default:' here on purpose: the out default of a source runs after
the steps that follow
+ # the Kamelet (see #3117). The body is the EventBridge event as JSON text.
+ out:
+ headers:
+ CamelAwsEventbridgeMessageId:
+ title: SQS Message ID
+ description: The ID of the SQS message that carried the event.
+ type: string
+ CamelAwsEventbridgeReceiptHandle:
+ title: Receipt Handle
+ description: The receipt handle of the SQS message, which SQS needs
to delete the message from the queue.
+ type: string
+ dependencies:
+ - "camel:aws2-eventbridge"
+ - "camel:kamelet"
+ template:
+ from:
+ uri: "aws2-eventbridge:{{eventbusNameOrArn}}"
+ parameters:
+ ruleName: "{{ruleName}}"
+ queueUrl: "{{?queueURL}}"
+ accessKey: "RAW({{?accessKey}})"
+ secretKey: "RAW({{?secretKey}})"
+ region: "{{region}}"
+ useDefaultCredentialsProvider: "{{useDefaultCredentialsProvider}}"
+ useProfileCredentialsProvider: "{{useProfileCredentialsProvider}}"
+ profileCredentialsName: "{{?profileCredentialsName}}"
+ useSessionCredentials: "{{useSessionCredentials}}"
+ sessionToken: "RAW({{?sessionToken}})"
+ uriEndpointOverride: "{{?uriEndpointOverride}}"
+ overrideEndpoint: "{{overrideEndpoint}}"
+ delay: "{{delay}}"
+ greedy: "{{greedy}}"
+ maxMessagesPerPoll: "{{maxMessagesPerPoll}}"
+ waitTimeSeconds: "{{waitTimeSeconds}}"
+ visibilityTimeout: "{{visibilityTimeout}}"
+ proxyHost: "{{?proxyHost}}"
+ proxyPort: "{{?proxyPort}}"
+ proxyProtocol: "{{?proxyProtocol}}"
+ steps:
+ - to:
+ uri: kamelet:sink
diff --git
a/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source-route.yaml
new file mode 100644
index 000000000..50e30a52f
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source-route.yaml
@@ -0,0 +1,90 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+# Receives the events of the rule with aws-eventbridge-source and passes them
on to the Citrus HTTP server.
+# Two events are put on the bus with aws-eventbridge-sink: first one that the
rule does not match
+# (Order Cancelled), then one that it matches (Order Shipped).
+- route:
+ from:
+ uri: "kamelet:aws-eventbridge-source"
+ parameters:
+ eventbusNameOrArn: "{{aws.eventbridge.eventbusName}}"
+ ruleName: "{{aws.eventbridge.ruleName}}"
+ overrideEndpoint: true
+ uriEndpointOverride: "{{aws.uriEndpointOverride}}"
+ accessKey: "{{aws.accessKey}}"
+ secretKey: "{{aws.secretKey}}"
+ region: "{{aws.region}}"
+ waitTimeSeconds: 1
+ steps:
+ # What the Kamelet gives
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - setHeader:
+ name: X-Message-Id
+ simple: "${header.CamelAwsEventbridgeMessageId}"
+ - setHeader:
+ name: X-Receipt-Handle
+ simple: "${header.CamelAwsEventbridgeReceiptHandle}"
+ - to:
+ uri: "{{http.sink.url}}/result"
+- route:
+ from:
+ uri: "timer:not-matched"
+ parameters:
+ repeatCount: 1
+ delay: 2000
+ steps:
+ - setBody:
+ constant: '{"orderId": "A-0"}'
+ - to:
+ uri: "kamelet:aws-eventbridge-sink"
+ parameters:
+ eventbusNameOrArn: "{{aws.eventbridge.eventbusName}}"
+ overrideEndpoint: true
+ uriEndpointOverride: "{{aws.uriEndpointOverride}}"
+ accessKey: "{{aws.accessKey}}"
+ secretKey: "{{aws.secretKey}}"
+ region: "{{aws.region}}"
+ resourcesArn: "arn:aws:s3:::orders"
+ eventSource: "{{aws.eventbridge.eventSource}}"
+ detailType: "Order Cancelled"
+- route:
+ from:
+ uri: "timer:matched"
+ parameters:
+ repeatCount: 1
+ delay: 4000
+ steps:
+ - setBody:
+ constant: '{"orderId": "A-1"}'
+ - to:
+ uri: "kamelet:aws-eventbridge-sink"
+ parameters:
+ eventbusNameOrArn: "{{aws.eventbridge.eventbusName}}"
+ overrideEndpoint: true
+ uriEndpointOverride: "{{aws.uriEndpointOverride}}"
+ accessKey: "{{aws.accessKey}}"
+ secretKey: "{{aws.secretKey}}"
+ region: "{{aws.region}}"
+ resourcesArn: "arn:aws:s3:::orders"
+ eventSource: "{{aws.eventbridge.eventSource}}"
+ detailType: "Order Shipped"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source.citrus.it.yaml
new file mode 100644
index 000000000..47ba76247
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/aws-eventbridge-source.citrus.it.yaml
@@ -0,0 +1,96 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: aws-eventbridge-source-test
+# aws-eventbridge-source receives the event that the rule matches, as the
whole EventBridge event in JSON text,
+# and not the event that the rule does not match, which was put on the bus
first
+variables:
+ - name: "aws.eventbridge.eventbusName"
+ value: "orders"
+ - name: "aws.eventbridge.ruleName"
+ value: "orders-shipped"
+ - name: "aws.eventbridge.eventSource"
+ value: "com.example.shop"
+actions:
+ # Create AWS infrastructure (Floci container)
+ - testcontainers:
+ start:
+ localstack:
+ services:
+ - "SQS"
+ - "EVENT_BRIDGE"
+
+ - waitFor:
+ http:
+ url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
+
+ # The event bus and the rule, which matches the events of type Order Shipped
+ - groovy:
+ script:
+ file: "aws/eventbridge/setupEventBridgeRule.groovy"
+
+ - camel:
+ cli:
+ run:
+ integration:
+ file: "aws/eventbridge/aws-eventbridge-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "aws.eventbridge.eventbusName"
+ value: "${aws.eventbridge.eventbusName}"
+ - name: "aws.eventbridge.ruleName"
+ value: "${aws.eventbridge.ruleName}"
+ - name: "aws.eventbridge.eventSource"
+ value: "${aws.eventbridge.eventSource}"
+ file: "aws/floci.properties"
+
+ # The first event that arrives is the one the rule matches: the body is the
whole event, as JSON text
+ - http:
+ server: "awsSinkServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ headers:
+ - name: "X-Body-Type"
+ value: 'java.lang.String'
+ - name: "X-Content-Type"
+ value: 'ct='
+ - name: "X-Message-Id"
+ value: '@matches(''[0-9a-f-]{36}'')@'
+ - name: "X-Receipt-Handle"
+ value: '@matches(''.+'')@'
+ validate:
+ - jsonPath:
+ - expression: '$.id'
+ value: '@matches(''[0-9a-f-]{36}'')@'
+ - expression: '$[''detail-type'']'
+ value: 'Order Shipped'
+ - expression: '$.source'
+ value: '${aws.eventbridge.eventSource}'
+ - expression: '$.resources[0]'
+ value: 'arn:aws:s3:::orders'
+ - expression: '$.detail.orderId'
+ value: 'A-1'
+ - http:
+ server: "awsSinkServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ body:
+ data: "OK"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/setupEventBridgeRule.groovy
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/setupEventBridgeRule.groovy
new file mode 100644
index 000000000..909989a93
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/aws/eventbridge/setupEventBridgeRule.groovy
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+// The event bus and the rule that aws-eventbridge-source receives the events
of. The Kamelet adds its own queue
+// to the rule; the event pattern of the rule decides which events arrive.
+
+import org.citrusframework.api.actions.testcontainers.aws2.AwsService
+import org.citrusframework.testcontainers.aws2.LocalStackContainer
+import software.amazon.awssdk.services.eventbridge.EventBridgeClient
+
+LocalStackContainer container =
context.getReferenceResolver().resolve(LocalStackContainer.class)
+EventBridgeClient eventBridgeClient =
container.getClient(AwsService.EVENT_BRIDGE)
+
+eventBridgeClient.createEventBus(b ->
b.name('${aws.eventbridge.eventbusName}'))
+
+eventBridgeClient.putRule(b -> b.name('${aws.eventbridge.ruleName}')
+ .eventBusName('${aws.eventbridge.eventbusName}')
+ .eventPattern('''
+ {
+ "source": ["${aws.eventbridge.eventSource}"],
+ "detail-type": ["Order Shipped"]
+ }
+ '''))