Running

This tutorial demonstrates NATS Streaming using example Go NATS Streaming clients.

Prerequisites

Setup

Download and install the NATS Streaming Server.

Clone the following repositories:

  • NATS Streaming Server: git clone https://github.com/nats-io/nats-streaming-server.git

  • NATS Streaming Client: git clone https://github.com/nats-io/stan.go.git

Start the NATS Streaming Server

Two options:

Run the binary that you downloaded, for example: $ ./nats-streaming-server

Or, run from source:

> cd $GOPATH/src/github.com/nats-io/nats-streaming-server
> go run nats-streaming-server.go

You should see the following, indicating that the NATS Streaming Server is running:

Run the publisher client

Publish several messages. For each publication you should get a result.

Run the subscriber client

Use the --all flag to receive all published messages.

Explore other subscription options

最后更新于

这有帮助吗?