The channel: one integration publishes, another reacts
Eventing 1 · 3:49
A channel is a name that two integrations share, so that one publishes invoices and the other reacts to them. The project declares the channel first, and the channel stores the events that pass through it.
This part of the video couldn't be loaded.
What it covers
- The watcher and creator routes, joined only by the channel name through the kamelets
weikio-event-sourceandweikio-event-sink - Declaring the channel in the project with
weikio channel create - The watcher's log, one line per arriving invoice
- The channel and its publisher in
weikio get channels - Stored events and their sequence numbers with
weikio events list - Reading the stored events in the Events section of the watcher's page in the admin UI
Commands in this video
Terminal
$ weikio channel create sandbox/invoice-created
$ weikio run ./invoice-watcher
$ weikio run ./invoice-creator
$ weikio logs sandbox/invoice-watcher --follow --since 10m
$ weikio get channels
$ weikio events list sandbox/invoice-createdTranscript
- 0:02An integration often must react to what another integration produced,
- 0:06without either one naming the other.
- 0:09This video shows two of them meeting through the name of a channel.
- 0:16Both integrations are written on your machine, in the project sandbox.
- 0:20Your Weik.io installation holds no version of either yet.
- 0:24Both will run in environment devtest, on the online agent dev.
- 0:31The from line names weikio-event-source, one of two built-in kamelets.
- 0:37It takes only the channel name invoice-created, agreed ahead of time.
- 0:42The route logs one line per event.
- 0:45The project declares the channel first:
- 0:47weikio channel create sandbox/invoice-created.
- 0:53Until then, a route naming the channel stays down.
- 0:57The channel now exists in the project's records.
- 1:00weikio run on the invoice-watcher folder builds and deploys a version,
- 1:04then keeps printing log lines as they arrive.
- 1:08The build gives the watcher its first version, 0.1.0.
- 1:12The deployment follows the newest version, starting on agent dev.
- 1:20A five-second timer fires, and the body carries one created invoice.
- 1:25weikio run builds and deploys the creator folder.
- 1:28The route ends at weikio-event-sink, the second built-in kamelet.
- 1:33The creator gets version 0.1.0 and runs beside the watcher on agent dev.
- 1:40The first invoice has landed on the channel, kept in Weik.io.
- 1:45The two routes share only the channel name.
- 1:47A new tile appears as each invoice is kept.
- 1:53The reaction shows on the watcher's log lines,
- 1:56so run weikio logs sandbox/invoice-watcher with the follow flag and a window of the last ten minutes.
- 2:05It prints that window first, oldest first,
- 2:08and then follows new lines as they arrive.
- 2:11This invoice left the creator moments ago, and its line appears here as it lands.
- 2:19Events go into the channel through a sink kamelet.
- 2:22Events come back out through a source kamelet.
- 2:28One command lists the project's channels: weikio get channels.
- 2:33Each row names who publishes into the channel and who reads it.
- 2:37The publishers cell shows invoice-creator.
- 2:41The readers cell shows invoice-watcher.
- 2:43Everything published is kept,
- 2:45and weikio events list for the channel reads those events back.
- 2:50One row per event, newest first, each naming the integration that published it.
- 2:56Every kept event carries a sequence number, the number its row is found by,
- 3:01and the drawing's tiles carry the same numbers.
- 3:07The admin UI shows the same events, on the watcher's page.
- 3:12The heading names the environment, and rows come newest first,
- 3:15with publisher and body.
- 3:17Opening an event shows its record: where it is kept, who published it, and the body.
- 3:27The creator publishes every invoice through one channel name.
- 3:31The channel keeps the events in Weik.io, in devtest's stream.
- 3:36The watcher reacts to them while the creator stays unknown to it.
Next in this track
Eventing 2 · 3:26 An event source brings events in Watched