Skip to content

murcialito/amqplib-simple

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amqplib-simple

Coverage Status

Simple interface to stablsis a connection, publish and consume messages based on configuration.

Install it using npm:

    npm i amqplib-simple

Create a new instance:

    const amqplibSimple = require('amqplib-simple')

Connection can be stablished with connect method, and the same connection can be closed using the close method or directly calling the close mehtod inside the connection object.

    const { connect } = amqplibSimple.connection

    connect(
        amqplibInstance, connString, exchangeName,
        exchangeType, queueName, queueArgs, routingKey
    )

Consumer offers a method to consume messages using a given async resolver function

    const { consume } = amqplibSimple.consumer
    const customResolver = () => Promise.resolve()

    consume(connection, customResolver)

Publisher offers a method to publish a new message for given channel

    const { publishOne } = amqplibSimple.publisher

    publishOne(msg, channel, exchangeName, queueName)

About

Simple wrapper for rabbitmq amqplib methods

Resources

Stars

Watchers

Forks

Packages

No packages published