Skip to content

Instantly share code, notes, and snippets.

@ripienaar
Last active July 23, 2020 08:33
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 ripienaar/e6691b2d692853eb89f7f09618084ba0 to your computer and use it in GitHub Desktop.
Save ripienaar/e6691b2d692853eb89f7f09618084ba0 to your computer and use it in GitHub Desktop.
nc.Subscribe("test", func(m *nats.Msg) {
for h, vals := range m.Header {
for _, val := range vals {
log.Printf("%s: %s", h, val)
}
}
if m.Reply != "" {
msg := nats.NewMsg(m.Reply)
msg.Header.Add("X-Demo", "value")
m.RespondMsg(msg)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment