连接名称
nc, err := nats.Connect("demo.nats.io", nats.Name("API Name Option Example"))
if err != nil {
log.Fatal(err)
}
defer nc.Close()
// Do something with the connectionOptions options = new Options.Builder().
server("nats://demo.nats.io:4222").
connectionName("API Name Option Example"). // Set Name
build();
Connection nc = Nats.connect(options);
// Do something with the connection
nc.close(); const nc = await connect({
name: "my-connection",
servers: ["demo.nats.io:4222"],
});nc = NATS()
await nc.connect(
servers=["nats://demo.nats.io:4222"],
name="API Name Option Example")
# Do something with the connection
await nc.close()最后更新于