Event Channels
Flexible event routing using Apache Camel Kamelets
Event Channels provide a flexible way to send CloudEvents to various target systems using Apache Camel Kamelets. Event Channels receive CloudEvents from NATS JetStream and deliver them to external destinations.
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 Weikio 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"