More than pub/sub
A stream captures the subjects you name and keeps them by age, by count or by bytes. A consumer starts at the beginning, at the newest message, at a sequence number or at a wall-clock time, and reads at the original pace or as fast as it can take them.
Paste and ship
Paste this into any agent. It reads the skill manifest and calls Pubsub from there.
Agent prompt
Read https://hanzo.ai/skill.md and use Hanzo Pubsub in my project. Start with: hanzo pubsub publish
4222Client port
ReplayFrom any point
DurableWritten to disk
ReplicasSet per stream
Publish and Subscribe
events.go
nc, _ := nats.Connect("nats://pubsub.hanzo.ai:4222")
js, _ := nc.JetStream()
// Create a durable stream
js.AddStream(&nats.StreamConfig{
Name: "EVENTS",
Subjects: []string{"events.>"},
Storage: nats.FileStorage,
Replicas: 3,
})
// Publish
js.Publish("events.user.signup", []byte(`{"id":"usr_123"}`))
// Durable consumer with ack
sub, _ := js.PullSubscribe("events.>", "my-service")
msgs, _ := sub.Fetch(10)
for _, msg := range msgs {
process(msg.Data)
msg.Ack()
}Open source royalty
20% to the author of the code that runs
Verify that you own a repository, and every org that deploys a project built from it pays you 20% of its metered spend, accrued each period.