Cameleer

AWS EventBridge component

The aws2-eventbridge component publishes events to Amazon EventBridge buses and manages rules and targets.

Scheme: aws2-eventbridge: · Crate: cameleer-cloud · Cargo feature: cloud · Consumer: no · Producer: yes · Apache Camel: AWS Eventbridge

When to use it

  • Emit business events (order placed, device offline) that serverless consumers react to.
  • Bridge events from on-premises systems, MQTT or Kafka into an AWS event-driven architecture.
  • Create and wire rules from an automation route (putRule, putTargets).

URI format

text
aws2-eventbridge://eventbusNameOrArn[?options]

Use default for the account's default event bus.

Example

Turn every order message into an OrderPlaced event on the default bus:

yaml example: aws2-eventbridge-put-order-event
- route:
    id: orders-to-eventbridge
    from:
      uri: "aws2-sqs://orders?region={{env:AWS_REGION:us-east-1}}"
      steps:
        - setHeader:
            name: CamelAwsEventbridgeEventSource
            constant: com.example.shop
        - setHeader:
            name: CamelAwsEventbridgeEventDetailType
            constant: OrderPlaced
        - to: "aws2-eventbridge://default?region={{env:AWS_REGION:us-east-1}}&operation=putEvent"
        - log: "event entry ids: ${body}"

The body is the event detail and must be JSON.

Rust DSL

rust
ctx.add_routes(|b| {
    b.from("aws2-sqs://orders?region={{env:AWS_REGION:us-east-1}}")
        .set_header("CamelAwsEventbridgeEventSource", constant("com.example.shop"))
        .set_header("CamelAwsEventbridgeEventDetailType", constant("OrderPlaced"))
        .to("aws2-eventbridge://default?region={{env:AWS_REGION:us-east-1}}&operation=putEvent")
        .log("event entry ids: ${body}");
})?;

Options

Common AWS options (region, credentials, endpoint override, proxy) are listed in Cloud credentials.

optiondefaultdescription
operationputRuleputRule, putTargets, removeTargets, deleteRule, enableRule, disableRule, describeRule, listRules, listTargetsByRule, listRuleNamesByTarget, putEvent. The CamelAwsEventbridgeOperation header overrides it.
eventPatternFileEvent pattern of putRule, read from a file (file: prefix or a plain path).

Note that the default operation is putRule, as in Apache Camel: set operation=putEvent to publish.

Message headers

headerdirectiondescription
CamelAwsEventbridgeOperationinOverrides operation.
CamelAwsEventbridgeEventSourceinSource of putEvent.
CamelAwsEventbridgeEventDetailTypeinDetail type of putEvent.
CamelAwsEventbridgeEventResourcesinResource ARNs of putEvent (list or comma separated).
CamelAwsEventbridgeFailedEntryCountoutFailed entries of putEvent.
CamelAwsEventbridgeRuleNameinRule of the rule operations.
CamelAwsEventbridgeRuleNamePrefixinPrefix of listRules.
CamelAwsEventbridgeEventPatterninEvent pattern of putRule.
CamelAwsEventbridgeTargetsinTargets of putTargets (list of {id, arn, input} maps).
CamelAwsEventbridgeTargetsIdsinIds of removeTargets.
CamelAwsEventbridgeTargetArninTarget of listRuleNamesByTarget.

Run it with Docker

sh
docker run --rm -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
  -v "$PWD:/routes:ro" pmsudhi/cameleer run /routes/events.camel.yaml

Common questions

How do I consume EventBridge events in a route?

Create a rule whose target is an SQS queue, and consume the queue with aws2-sqs. The event arrives as the JSON envelope (source, detail-type, detail, ...).

Why was my event not delivered?

Check CamelAwsEventbridgeFailedEntryCount, then the rule's event pattern: source and detail-type must match exactly.

Found a problem?

If something on this page doesn't match what Cameleer does, or you hit a bug while building with it, please help fix it, whether you are a person or a coding agent: open an issue that describes what you saw, then fork the repository, fix it, add or update a test, run cargo test --workspace, and open a pull request. CONTRIBUTING.md explains the ground rules.

Edit this page on GitHub