5.2.3 • Published 3 months ago

@proca/queue v5.2.3

Weekly downloads
-
License
AGPL-3.0
Repository
-
Last release
3 months ago

Proca SDK: queue helpers

Proca server pushes actions through AMQP queues, to which you can plug in your microservice. This module provides few helpers to work with queues.

if you intend to sync with a crm, you might want to start with this higher level template

TypeScript types

  • ActionMessageV2 - a type describing message with an action data
  • EventMessageV2 - a type describing message with an event data

Functions

  • syncQueue(url, queueName, callback, options) - Start reading actions and events from queueName queue from AMQP server at url. For each action or event, callback is called.

    • options is a map with:

      • concurrency - if set, set number of messages to be processed at the same time
      • keyStore - decryption key store (see @proca/crypto module) if PII of supporters is to be decrypted
    • Callback signature is: async callback(action : ActionMessageV2 | EventMessageV2)

    • it returns boolean (or {processed:boolean{) if false, the message is nacked. if it's the first time the message has been processed, it is directly requeued, otherwise, it's dropped (pushed in the dead-letter queue and replayed later)

    • if this function throw an error, we are going to close the connection

    • TODO: testQueue(url, queueName) - If queue queueName exists on AMQP server url, return its stats

AMQP authentication

Use HTTP Basic Auth inlined in url to authenticate to AMQP server (eg. amqps://username:password@example.com:1572).

Version 5.0.0

Function syncQueue is updated to manage the case when it needs to nack a message without closing the channel. It will fail if the callback does not return the boolean. All the apps that use version 3 of this function should be adapted before updating, or they will break.

5.2.3

3 months ago

5.2.2

3 months ago

5.2.1

3 months ago

5.2.0

3 months ago

5.0.6

9 months ago

5.0.5

10 months ago

5.0.4

10 months ago

5.0.3

10 months ago

5.1.0

9 months ago

5.0.8

9 months ago

5.0.7

9 months ago

5.0.2

11 months ago

5.0.1

11 months ago

5.0.0

11 months ago

4.0.0

12 months ago

3.4.0

1 year ago

0.2.5

1 year ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago