0.1.9 • Published 4 years ago
@peregrine/mq-lib v0.1.9
MQ-lib
Very simple and minimal amqplib wrapper.
Methods - MqService class
Method | Description |
---|---|
static connectOnce(url: string): Promise<MqService> | Creates a connection to the RabbitMQ instance at the specified url . |
static connect(url: string, maxNumOfTries = 10): Promise<MqService> | Creates a connection to the RabbitMQ instance at the specified url . Tries to connect at least 10 times (unless otherwise specified). |
addListener(queueName: string, listener: (data: string) => Promise<boolean>): void | Adds a listener to the queue with name queueName . When the listener returns a true, an ACK is sent. |
sendMessage(queueName: string, data: Json) | Sends a message to the queue with name queueName . The message can be a string or JSON. |
close(): Promise<void> | Closes the connection |