Sending data to several destinations
Patterns 2 · 3:04
Each of three destinations gets its own reader on the invoice channel. While the archive is down, the accounting and billing systems keep receiving invoices, and the archive's copy waits in Weik.io.
What it covers
- The channel
invoice-created, which posts every invoice to accounting only - Listing a channel's readers with
weikio get readersand on the admin UI's Events page archive.yamlandbilling.yaml, each a subscription and a channel for one destination- Publishing and deploying all four documents with
weikio run ./destinations - A durable consumer for each reader, which tracks what it has finished
- A one-minute archive outage seen under Event delivery, and the retries that deliver the waiting invoice
Commands in this video
Terminal
$ weikio get readers sandbox/invoice-created --env devtest
$ weikio run ./destinations --no-logs
$ weikio get readers sandbox/invoice-archive --env devtestTranscript
- 0:02Three systems need every invoice, and one going down must not stop the other two.
- 0:11invoice-files puts new invoices into its channel every minute.
- 0:16The subscription files-to-invoices passes them into the channel invoice-created.
- 0:22That channel posts every invoice to the accounting system.
- 0:26The archive and billing get nothing yet.
- 0:29The pattern is a reader for each destination.
- 0:36weikio get readers lists each integration reading a channel and how far behind it is.
- 0:42invoice-created has two today.
- 0:49archive.yaml holds a subscription and a channel.
- 0:53invoices-to-archive copies every invoice from invoice-created into invoice-archive.
- 0:59That channel posts each invoice to the archive.
- 1:02billing.yaml gives billing the same pair.
- 1:07weikio run ./destinations publishes and deploys all four documents.
- 1:17Each destination now has its own subscription and channel.
- 1:21Every read gets a durable consumer that tracks what it has finished.
- 1:25The next invoice reaches all three in the same second.
- 1:32Run the command again.
- 1:36invoice-created now has four readers.
- 1:38The two new rows are the archive's subscription and billing's.
- 1:43The admin UI's Events page lists the same four.
- 1:50The archive stops answering for a minute.
- 1:52That minute's invoice still reaches accounting and billing.
- 1:56It waits at the hub for the archive's reader.
- 1:59Run weikio get readers for invoice-archive.
- 2:03The reader is one behind, with one retrying.
- 2:09The admin UI puts the same numbers under Event delivery on invoice-archive's page.
- 2:15accounting and billing keep receiving invoices while the archive's reader stays one behind.
- 2:23The archive answers again.
- 2:26The next try delivers the invoice that waited,
- 2:29and the waiting tile clears from the invoice-archive chip.
- 2:33A failed delivery is retried a few seconds later, then after longer waits.
- 2:38The archive's line carries a later time than the other two for the same invoice.
- 2:46invoice-created now feeds four readers.
- 2:49The invoice that waited arrived on the next try.
- 2:52One shared route would have held up the other two whenever one was down.
Next in this track
Patterns 3 · 3:15 Running an integration on a schedule Watched