Basic JavaScript communicator implementation for SQS
-
options
-object
- Options to create a communicator with -
options.credentialsUrl
-string
- The url to invoke to retrieve AWS credentials & context -
options.publishUrl
-string
- The url to invoke to publish -
options.subscribeUrl
-string
- The url to invoke to subscribe to a specific topic -
options.getHeaders
-Function
- A function which provides headers while invoking requests -
options.authenticationEmitter
-Emitter
- An emitter which should emit anauthenticated
event when authenticated, and aunauthenticated
event when unauthenticated, this will stop & start listening
-
Communicator
- Described below
-
topic
-string
- The topic to listen to -
onMessage
-Function
- The function to invoke when there is an -
onError
-Function
- The function to invoke when an error has occurred (Optional) -
onCancel
-Function
- The function to invoke when the subscription is completed being cancelled (Optional)
-
Promise.<Function>
- A promise resolving in a function which can be invoked to cancel listening
-
topic
-string
- The topic to listen to
-
Promise.<ListenerEmitter>
- A promise resolving in an emitter with an additionalcancel
function which can be invoked to cancel the listener
-
topic
-string
- The topic to publish to -
payload
-string
- The payload to publish to
-
Promise
- A promise which resolves once the message has been published