Event Channels
Route CloudEvents to external systems using Apache Camel Kamelets
Event Channels route CloudEvents to other systems using Apache Camel Kamelets. A channel consumes CloudEvents from NATS JetStream and delivers them to the configured target system.
Configuration format
Event channels are configured using YAML files:
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: slack-notifications
description: Send events to Slack channel
spec:
type: slack
parameters:
webhookUrl: "{{slack_webhook}}"
channel: "#notifications"
variables:
- slack_webhook: "{{sys:SLACK_WEBHOOK_URL}}"
requirements:
network: "true"
Applying configuration
Use the Weik.io CLI to apply event channel configurations:
weikio config apply filename.yaml
API endpoints
GET /eventchannels/configurations- Returns all event channels
- Requires “EventChannel.Read” policy
GET /eventchannels/configurations/{name}- Returns a specific event channel by name
- Requires “EventChannel.Read” policy
Event channel types
Event channels are based on Apache Camel Kamelets. You can use any sink Kamelet from the Apache Camel Kamelet catalog.
Slack channel
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: slack-notifications
description: Send events to Slack channel
spec:
type: slack
parameters:
webhookUrl: "{{slack_webhook}}"
channel: "#notifications"
variables:
- slack_webhook: "{{sys:SLACK_WEBHOOK_URL}}"
requirements:
network: "true"
AWS S3 channel
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: s3-archive
description: Archive events to AWS S3 bucket
spec:
type: aws-s3
parameters:
bucketNameOrArn: "events-archive"
accessKey: "{{aws_access_key}}"
secretKey: "{{aws_secret_key}}"
region: "us-east-1"
autoCreateBucket: "true"
variables:
- aws_access_key: "{{sys:AWS_ACCESS_KEY}}"
- aws_secret_key: "{{sys:AWS_SECRET_KEY}}"
requirements:
network: "true"
HTTP channel
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: webhooksite-http
description: Send events to Webhooksite
spec:
type: http
parameters:
url: "{{target}}"
method: "POST"
variables:
- target: "{{sys:webhooksite}}"
Event processing
When an event channel is configured:
A NATS JetStream stream is automatically created
- Stream name:
eventchannel-{name}-stream - Subject:
eventchannel.{name} - Republish configuration to
eventchannelprocessing.{name}
- Stream name:
An Integration Flow is created using the specified Kamelet
- Flow reads CloudEvents from the NATS processing subject
- CloudEvents are sent to the target system using the sink Kamelet
Integration with other features
Variables support
Event channels can use variables in their configurations:
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: s3-archive
spec:
type: aws-s3
parameters:
bucketNameOrArn: "events-archive"
accessKey: "{{aws_access_key}}"
secretKey: "{{aws_secret_key}}"
variables:
- aws_access_key: "{{sys:AWS_ACCESS_KEY}}"
- aws_secret_key: "{{sys:AWS_SECRET_KEY}}"
Requirements
Event channels support requirements specification:
apiVersion: weik.io/v1alpha1
kind: EventChannel
metadata:
name: slack-notifications
spec:
type: slack
parameters:
webhookUrl: "{{slack_webhook}}"
variables:
- slack_webhook: "{{sys:SLACK_WEBHOOK_URL}}"
requirements:
network: "true"