Skip to content

Instantly share code, notes, and snippets.

@StarpTech
Last active January 4, 2020 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StarpTech/91eb17613715c9b4f068ae67b7c8bcd4 to your computer and use it in GitHub Desktop.
Save StarpTech/91eb17613715c9b4f068ae67b7c8bcd4 to your computer and use it in GitHub Desktop.
Event Store subscription
sub, err := sc.Subscribe("eventstore.events", func(m *stan.Msg) {
fmt.Printf("Received a message: %s\n", string(m.Data))
// your code
if err := m.Ack(); err != nil {
// event is redelivered
return
}
},
stan.maxInFlight(1),
stan.AckWait("30s"),
stan.SetManualAckMode(),
stan.DurableName(durableName),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment