Skip to content

This repository is an example of NSQ in Node JS using nsqjs.

Notifications You must be signed in to change notification settings

retry19/example-nsqjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of NSQ in Node JS

This repository is an example of NSQ in Node JS using nsqjs, I built very simple app for convert text to uppercase, so we can publish some text, and that text will convert to uppercase by subscriber.

  • Publisher -> writer.js

  • Subscriber -> reader.js

Getting Started

1. Setup

For setup repository you must only run :

npm run setup

It's will copy .env.example to .env and then install dependencies

Or you can copy manually .env.example to .env and then run :

npm i

Make sure configuration for NSQ in .env is correct (according to your environment).

2. Run App

Run subscriber to listen all messages from publisher :

npm run reader

After reader.js was running, you can test it with send default message, with run this :

npm run writer:test

Or you can send custom text, using this command :

npm run writer <INPUT_TEXT>

Replace <INPUT_TEXT> with text as you like, for example :

npm run writer "Luffy is not paramecia type"

You can using quote or not

About

This repository is an example of NSQ in Node JS using nsqjs.

Topics

Resources

Stars

Watchers

Forks