1.4.0 • Published 1 year ago

@hindawi/queue-service v1.4.0

Weekly downloads
405
License
MIT
Repository
gitlab
Last release
1 year ago

Message Queue Service

This service adds the ability to connect to a SQS message queue, consume messages and publish messages to SNS

It is best used if you employ a SNS/SQS setup for interservice communication

sns/sqs setup visual

API

  • createQueueService() - creates an instance of the messageQueueService
  • service.publishMessage(message) - publishes a message to the configure SNS topic.
    The message should be of type {event: String, data: Any, timestamp?: Date.toISOString, messageAttributes?: Object}
  • service.registerListener({event: String, handler: Function}) - registers a handler function for the specified event.
    You can register multiple handlers for each event. To do this, you can call this function multiple times with the same event value
    The service will call all handlers registered for the event value found in the message
  • service.startListening() - starts listening on the specified queue

Required Env vars

NODE_ENV=development
AWS_SNS_SQS_REGION=us-east-1
AWS_SNS_SQS_ACCESS_KEY=****
AWS_SNS_SQS_SECRET_KEY=****
AWS_SQS_ENDPOINT=http://localhost:4566
AWS_SNS_ENDPOINT=http://localhost:4566
AWS_SNS_TOPIC=test1
AWS_SQS_QUEUE_NAME=screening-queue

Usage

If you want to use it in an xpub app, you can find an example here.

Check this documentation for an example of how you can configure a SNS/SQS clone service to run locally in docker.

1.4.0

1 year ago

1.3.28

1 year ago

1.3.27

2 years ago

1.3.26

2 years ago

1.3.4

4 years ago

1.3.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.3

4 years ago

1.1.0

4 years ago

1.0.12

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago