Skip to content

workerJS/workerjs-rabbitmq

Repository files navigation

workerjs-rabbitmq

Abstraction layer for using queue and messaging as event listeners.

Messaging

Receive

const messaging = require("workerjs-rabbitmq")().messaging;

messaging.on("test", function(data){
	console.log(data);
}).then(function(){
	console.log("Subscribed");
}).catch(function(){
	console.log("Error while subscribing");
});

Send

const messaging = require("workerjs-rabbitmq")().messaging;

messaging.emit("test", 123).then(function(){
	console.log("Sent");
}).catch(function(){
	console.log("Error while sending");
});

Queue

Receive

var queue = require("workerjs-rabbitmq")().queue;

queue.on("tasks", function(data){
	console.log(data);
});

Send

var queue = require("workerjs-rabbitmq")().queue;

queue.emit("tasks", "123").then(function(){
	console.log("Sent");
}).catch(function(){
	console.log("Error while sending");
});

About

Interface for interacting with messaging server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published