So I just built a docker container from current github repo and that resolved monitoring issue for me. Now we have another big issue.
We've setup 2 nats-streaming-server's in a FT group, with one being active and one standby. Also we have subscriber and publisher connecting to the server. At first everything works, publisher publishes messages and client receives them.
But when we kill the active node, clients stop receiving messages. Also when we bring active node back online, system is still in a hold, meaning no messages get delivered.
Is there some additional client code we need to write to resubscribe to another server?
Ex. code we are using:
type NStreamingQueue struct {
clientId string
nc *stan.Conn
}
func (n *NStreamingQueue) Publish(topic, message string) error {
if len(message) == 0 {
return nil
}
con := *n.nc
if err := con.Publish(topic, []byte(message)); err != nil {
fmt.Printf(“Error pushing to nats: %s”, err.Error())
return err
}
return nil
}
func (n *NStreamingQueue) Consume(topic string, handler func(msg *stan.Msg)) error {
con := *n.nc
if sub, err := con.Subscribe(topic, handler, stan.DurableName(n.clientId)); err != nil {
sub.Unsubscribe()
fmt.Println(“Error receiving a message: “, err.Error())
return err
}
return nil
}
func (n *NStreamingQueue) Healthcheck() bool {
return n.Healthcheck()
}
func NewNStreamingQueue(urls, clientId string) (*NStreamingQueue, error) {
nc, err := stan.Connect(“test-cluster”, clientId, stan.NatsURL(urls))
if err != nil {
fmt.Println(“Error connecting to nats: “, err.Error())
return nil, err
}
return &NStreamingQueue{nc: &nc, clientId: clientId}, nil
}