Event sources
Weik.io 2026.2An event source brings events in from a queue, a bucket, a webhook or a folder with any Camel source kamelet, and publishes them into a channel of its own 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
An event source brings events in from a system outside Weik.io: a message queue, a storage bucket, a folder, a mailbox or anything else a Camel source kamelet can consume. You write one document with the kamelet’s name and its parameters, and the platform generates the route.
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, which the build adds, so aws-s3 is Camel’s aws-s3-source. parameters are that kamelet’s own, as Camel’s kamelet catalog lists them, and each value can be a placeholder for a variable or a secret.
The source publishes into a channel with its own name, here invoice-files. That channel needs no document of its own, and listing, re-sending and subscriptions work on it as on any declared channel.
Apply and deploy it#
A source is an integration like any other: it has versions, a deployment per environment and an agent that runs it.
$ 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. A source then sets the type, the source and the subject of its events with Camel simple expressions, which read the body the event stores:
spec:
type: aws-s3
parameters: { bucketNameOrArn: "{{invoice-bucket}}", region: eu-north-1 }
eventType: com.example.invoice.file
eventSource: /erp/invoicesChange events on the way#
steps is a list of kamelet actions between the source and its channel, as in a Camel K Pipe, such as json-deserialize-action from Camel’s catalog 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 says what happens to an exchange that fails: log writes the failure once at ERROR with the exception and the body, which is the default for a source, none leaves it failed, and { sink: { channel: failed-files } } or { sink: { http: <url> } } sends it to another channel or a URL. A publish Weik.io didn’t store is never counted as handled.
To bind a source to a channel other than its own, or to deliver its events somewhere, add a subscription.