Giter Site home page Giter Site logo

nats-proxy's Introduction

nats-proxy

This proxy server allows clients to arbitrarily specify a NATS.io subject and publish messages directly to NATS.io without using the default NATS.io client libraries.

Install

$ npm install -g nats-proxy

Usage

$ nats-proxy --help

NATS.io messaging proxy

usage: nats-proxy [options]

options:
  -p --port    Port number (Default: 8080)
  -n --nats    NATS server URL (Default: nats://0.0.0.0:4222)
  -d --debug   Enable debug output
  -t --tls     Enable TLS / HTTPS
  -C --cert    Server certificate file
  -K --key     Private key file
  -h --help    Print this list and exit
  -v --version Print the current version

Publishing data to NATS

External clients can issue HTTP post requests to the default route / and publish messages directly to NATS.io, for example:

curl -s -H "Content-Type: application/json" \
-X POST -d '{"__subject":"CUSTOMER","account":"ACC-123456789","orders":"PO-123456789"}' \
http://localhost:8080/

This command will post the JSON data to the default route http://localhost:8080/, the nats-proxy server will read and parse the JSON data and will publish this data to NATS.io with a subject called CUSTOMER.

Monitoring

You can monitor nats-proxy and view live stats by accessing the http://localhost:8080/.

Run in Docker container

You can run nats-proxy in a Docker container as follows:

# pull the image
docker pull aaguilar/nats-proxy

# run the container
docker run -it --rm -p 8080:8080 aaguilar/nats-proxy -p 8080 -n nats://localhost:4222

nats-proxy's People

Contributors

antonioaguilar avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

codemonkeybot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.