Skip to content

Commit

Permalink
allow also tailing response messages
Browse files Browse the repository at this point in the history
  • Loading branch information
taigrr committed Jun 8, 2023
1 parent 0c86c94 commit 92f1a1b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/grlx/cmd/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ var tailCmd = &cobra.Command{
if err != nil {
log.Fatal(err)
}
sub2, err := ec.Subscribe("_INBOX.>", func(msg *nats.Msg) {
printTex.Lock()
fmt.Println(msg.Subject)
fmt.Println(string(msg.Data))
printTex.Unlock()
})
if err != nil {
log.Fatal(err)
}
defer sub.Unsubscribe()
defer sub2.Unsubscribe()
defer nc.Flush()
select {}
},
Expand Down

0 comments on commit 92f1a1b

Please sign in to comment.