I am writing a script that connects to a NATS
server. In this code I am trying to make it so that I can add multiple consumers to multiple different streams if needed, my question is whether or not it actually adds it to the stream if I use an underscore in the if statement. Also if anyone could help explain it in more detail.
consumerNames := map[string]string{
"consumer-99": "test-subject-99",
"consumer-100": "test-subject-100"
}
//loops through the Map above to add consumers to specific subjects on the stream
for consumerName , subjectName := range consumerNames{
if _, err := js.AddConsumer(streamConfig.Name, &nats.ConsumerConfig {
Durable: consumerName,
DeliverySubject: subjectName,
AckPolicy: nats.AckExplicitPolicy
}
); err != nil {
log.Fatalf("Can not add consumer to specified subject in stream: %v", err)
}
}