sajjaphani / nats-pubsub

Pub/Sub with NATS.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pub/Sub with NATS.io

This repository is a Go project for experimentation on NATS.io. It contains the following components:

  • server: Starts NATS server
  • publisher: Implementation of a Go client that acts as a publisher
  • subscriber: Implementation of a Go client that acts as a subscriber

The server component will run the NATS server with the JetStream subsystem enabled. The structured messages are sent and received using the standard JSON encoding over JetStream.

Setup

  1. Seart the server
  2. Start the subscriber
  3. Start the publisher

Please refer to the following sections for instructions on how to start each of these individual components.

Server

Run the following command to start the server:

cd components/server
go run main.go server.go

Publisher

Run the following command to start the publisher:

cd components/pub
go run main.go

Subscriber

Run the following command to start the subscriber:

cd components/sub
go run main.go

About

Pub/Sub with NATS.io


Languages

Language:Go 100.0%