Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 1016 Bytes

230418.channels.md

File metadata and controls

17 lines (15 loc) · 1016 Bytes

2023-04-17

https://discordapp.com/channels/918498540232253480/918498540232253483/1097624239747641454

kasperl

Artemis v0.5.0 comes with a flash-backed channel implementation that allows you to store logs and events in a cyclic buffer that gets encoded and checksummed: https://pkg.toit.io/github.com/toitware/[email protected]/docs/artemis/class-Channel. We will let you use partitions of your choice to back such channels and we imagine that you can set it up so Artemis automatically forwards the entries to your broker when it connects to your cloud infrastructure.

channel := artemis.Channel.open --topic="mytopic" --receive
5.repeat: channel.send #[1, 2, 3, 4, 5]
n := 0
while not channel.is_empty: 
  print channel.receive
  n++
channel.acknowledge n
channel.close (edited)

Notice that the received elements aren't automatically acknowledged, so you really want to tell the channel when you've received and handled the elements. The elements have positions so you can detect gaps and duplicates.