Code Monkey home page Code Monkey logo

menashmq's People

Contributors

randomize163 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

menashmq's Issues

Unwanted behaviour of library logging

Hi,

When connection fails an MenashMQ logs to user "[RabbitMQ Client] Starting reinitialize...". This does not allow monitoring of logs with their logging libraries.

Possible solution:
Add possibility of listening to "reinitialize event" so user can decide how to log the error.
maybe for simplifying, keep the default behaviour, because many clients will forget to listen to that event.

Example syntax

import menash from 'menashmq';
menash.on('errror', (err) => logger.log(err));

Add consumers as part of declareTopology()

Currently menash.declareTopology() defines queues, exchanges and bindings.

I suggest adding consumers to the list:
{
consumers: [
{ queue: string | Queue, consume: (msg: ConsumerMessage)=> {}, options: ConsumeOptions},
],
}

Channel::isInitialized() is overridden by Queue and Exchange

Channel::isInitialized() is overridden by Queue and Exchange.
When parent class Channel checks if it initialized (by calling isInitialzed()) it calls childs function isInitialized() and gets the wrong result causing connection handle to leak.

Add 'isConnected' function to menash

Currently, it seems there is no way to know whether or not there already is a connection to rabbit, which complicates the users of the package.
An isConnected function could fix that.

Add option to connect to multiple rabbitmq instances

Add option to manage a connection pool of different, unrelated, rabbitmq instances.

possible solution:
Same solution as mongoose (see here), that creates a connection and returns an instance of an object exposing the same API as exposed by the default library.

declareExchange() with missing type argument doesn't throw

When user forgets to specify the exchange type, menashmq should throw an error explaining what types of exchanges are supported.

I think there should be no default value for exchange. User should understand the differences and choose the best option for his use case.

Documentation Fix

Hi,

In the Typescript-Support paragraph

import menash from 'menashmq';

await menash.connect('amqp://localhost');
await menash.declateQueue('menash-queue');

Need to change from declateQueue to declareQueue.

Thank you so much for this awsome package @Randomize163

Add RPC support

Need to add support for RPC Client and Server

Usage could look like this:

Client:
const result = await menash.rpc('server-queue-name', { info: "some request" });

Server:
await menash.activateRpcServer('server-queue-name', (msg: ConsumerMessage) => { msg.reply({ info: "my reply" }); })

Unhandled consumer error nack-ing twice

Hi,

if my consumer throws after I already acked/nacked message, MenashMQ throws the following error:

(node:46) UnhandledPromiseRejectionWarning: Error: [BUG] message already processed ack: false nack: true
at ConsumerMessage.nack (/usr/src/app/node_modules/menashmq/dist/lib/message.js:53:19)
at consume (/usr/src/app/node_modules/menashmq/dist/lib/queue.js:106:29)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

This happens because MenashMQ nack-ing message for the consumer because it assumes consumer throwed before ack-ing.

see in MenashMQ consumer wrapper:

message.nack(false);
.

Will create pull request soon that checks message.acked and message.nacked fields before nacking.

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.