diff --git a/tools/nats_caller.go b/tools/nats_caller.go index ffa4f2d..2e477c9 100644 --- a/tools/nats_caller.go +++ b/tools/nats_caller.go @@ -2,6 +2,7 @@ package tools import ( "encoding/json" + "fmt" "strings" "sync" "time" @@ -103,12 +104,14 @@ func (o *natsCaller) SetNATSPub(method NATSMethod, data NATSResponse) string { for { nc, err := nats.Connect(config.GetConfig().NATSUrl) if err != nil { + fmt.Println("NATS Connect err", err) time.Sleep(1 * time.Minute) continue } defer nc.Close() js, err := json.Marshal(data) if err != nil { + fmt.Println("NATS Marshal err", err) return " -> " + err.Error() } err = nc.Publish(method.GenerateKey(), js) // Publish the message on the NATS server with a channel name based on the data name (or whatever start) and the method