go

command module
v0.0.0-...-274553e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: MIT Imports: 3 Imported by: 0

README

NATS.io logo

your NATS connection deserves a name: Go edition

An example on how to assign a name to a NATS.io connection in Go.

Get it running

  1. Start the NATS docker container:
$ docker run --rm \
    --publish 4222:4222 \
    --publish 8222:8222 \
    --name ycdan-nats \
    --detach \
    nats:2.3.4
  1. Compile the example program:
$ go build -o your-connection-deserves-a-name
  1. Start the example program:
$ ./your-connection-deserves-a-name

You should see something like

2021/08/07 14:17:17 Connecting to NATS on nats://127.0.0.1:4222
2021/08/07 14:17:17 Connecting to NATS on nats://127.0.0.1:4222 ... Successful
2021/08/07 14:17:17
2021/08/07 14:17:17 Keeping the connection open ...
2021/08/07 14:17:17 You can connect to the NATS monitoring endpoint: http://127.0.0.1:8222/connz
2021/08/07 14:17:17 Hit CTRL + C or cancel the process to stop.
2021/08/07 14:17:17
  1. Visit the NATS monitoring endpoint at http://127.0.0.1:8222/connz and confirm the connection name.

Don't know what this is all about?

Read the original blog post your database connection deserves a name @ andygrunwald.com.

Additionally, you can check out the projects README.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL