Skip to content

emilioriosvz/rabbit-nodejs-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Standard - JavaScript Style Guide PRs Welcome

Getting Started

First of all install Rabbit. If you are using docker you can just do

  docker run -d --name gaia-rabbit -p 15672:15672 -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 25672:25672  rabbitmq:3-management

This image comes with the management plugin installed. You can see what happens inside rabbitmq entering http://localhost:15672/. Auth by default guest:guest

After that clone the repo:

git clone git@github.com:emilioriosvz/rabbit-nodejs-example.git
cd rabbit-nodejs-example

Install dependencies

This repo is composed of 3 different node processes, therefore you have to install the dependencies in all of them

cd consumer && npm i && cd ../ddos && npm i && cd ../sender && npm i && cd ..

Explanation

In order to execute this example you have to run the services in this order:

Sender

It is a very simple server with only one endpoint that emit to a queue when it is called

Run it with node index.js

Receiver

It is a very simple process that is simply waiting for something to arrive in the queue that is listening

Run it with node index.js

If you want to try, you can launch this process simultaneously as many times as you want to see how rabbit distributes the work among the different consumers.

Ddos

This script calls an endpoint in loop.

Run it with node index.js 1000 where 1000 is the frequency with which you will call that endpoint

About

πŸ°πŸ’» Very simple example to show how Rabbit and Node can work together

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published