Skip to content

eigr-labs/nats-jetstream-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actor Nats Poc

  1. Start Nats with Jetstream enabled
docker-compose up
  1. Start application
iex -S mix
  1. Create a bucket and start a jetstream replication
alias ActorNatsPoc.Statestore.KV, as: StatestoreKV
StatestoreKV.create_replication_bucket("test", "actors.mike")
  1. Start Projection
opts = [name: "test", stream_name: "newtest", subjects: ["actors.*"], consumer_name: "projectionviewertest"]
ActorNatsPoc.Projection.start_link(opts)
  1. Put new key value into bucket
StatestoreKV.put("test", "mykey", "myvalue")
  1. See the follow consumer logs in the iex console
Processing message: %Broadway.Message{data: "{\"action\":\"key_added\",\"key\":\"mykey\",\"value\":\"myvalue\"}", metadata: %{headers: [], topic: "actors.mike"}, acknowledger: {OffBroadway.Jetstream.Acknowledger, #Reference<0.4061493138.1171259399.101594>, %{reply_to: "$JS.ACK.newtest.projectionviewertest.1.161067.161063.1725488338796149600.5"}}, batcher: :default, batch_key: :default, batch_mode: :bulk, status: :ok}
  1. To replay events do:
ActorNatsPoc.Projection.replay([])

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages