Event sources
Weik.io 2026.2Bring events in from another system with any Camel source kamelet, into a channel with the source's name. Product page · Video
Watch: An event source brings events in, 3:26
The video brings events in from an outside system with an event source.
This part of the video couldn't be loaded.
On this page
To bring events in from a system outside Weik.io, such as a message queue or a storage bucket, write an event source document with the name of any Camel source kamelet and its parameters. Weik.io generates the route from it.
Write the source#
apiVersion: weik.io/v1
kind: event-source
metadata: { name: invoice-files, project: finance }
spec:
type: aws-s3
parameters:
bucketNameOrArn: "{{invoice-bucket}}"
accessKey: "{{aws-access-key}}"
secretKey: "{{aws-secret-key}}"
region: eu-north-1type is the source kamelet’s name without its -source suffix, so aws-s3 is Camel’s aws-s3-source.
parameters are that kamelet’s parameters, as Camel’s kamelet catalog lists them. Each value can be a placeholder for a variable or a secret.
The source publishes into a channel with the source’s name, here invoice-files. That channel needs no document, and it works like any channel you declare.
Apply and deploy it#
A source has versions and a deployment in each environment, as any integration does.
$ weikio apply -f ./finance/events/Target: https://hub.example, project finance (from finance/project.yaml)
event-channel finance/invoice-created unchanged
event-channel finance/invoice-alerts created (version 0.1.0, built in 14.2 s, delivers to slack)
event-source finance/invoice-files created (version 0.1.0, built in 16.8 s, aws-s3 -> invoice-files)
event-subscription finance/files-to-invoices created (version 0.1.0, built in 15.1 s, invoice-files -> invoice-created)
event-subscription finance/alert-on-invoices created (version 0.1.0, built in 14.9 s, invoice-created -> invoice-alerts)
Nothing new is running yet. To run it:
weikio deploy -f ./finance/events --env devtest$ weikio deploy finance/invoice-files --env productionAn event source runs one copy at a time by default, so a bucket that two agents could read is read once.
Set the CloudEvents attributes#
Every stored event carries CloudEvents 1.0 attributes. In its document, a source sets some of them with Camel simple expressions, which can use the event’s body:
| Field | Attribute it sets |
|---|---|
eventType |
The type |
eventSource |
The source |
subject |
The subject |
spec:
type: aws-s3
parameters: { bucketNameOrArn: "{{invoice-bucket}}", region: eu-north-1 }
eventType: com.example.invoice.file
eventSource: /erp/invoicesAdd steps#
To change events before they reach the channel, add steps, a list of kamelet actions as in a Camel K Pipe. A step can be a kamelet from Camel’s catalog, such as json-deserialize-action, or a kamelet of your project:
spec:
type: aws-s3
parameters: { bucketNameOrArn: "{{invoice-bucket}}", region: eu-north-1 }
steps:
- kamelet: json-deserialize-actionWhen the source fails#
errorHandler sets what happens to an exchange that fails:
| Value | What happens |
|---|---|
log |
Writes the failure once at ERROR with the exception and the body. This is the default for a source. |
none |
Leaves the exchange failed |
{ sink: { channel: failed- |
Sends the exchange to another channel |
{ sink: { http: <url> } } |
Sends the exchange to a URL |
An event that Weik.io didn’t store never counts as handled.
To bind a source to a channel other than its own, or to deliver its events somewhere, add a subscription.