Disabling Reconnect
Go
server("nats://demo.nats.io:4222").
noReconnect(). // Disable reconnect attempts
build();
Connection nc = Nats.connect(options);
// Do something with the connection
JavaScript
await nc.connect(
servers=[
"nats://demo.nats.io:1222",
"nats://demo.nats.io:1223",
"nats://demo.nats.io:1224"
],
allow_reconnect=False,
# Do something with the connection
await nc.close()
Ruby
// will throw an exception if connection fails
let nc = await connect({
reconnect: false,
servers: ["nats://demo.nats.io:4222"]
C