@veterancrowd/wrapped-sqs-client
v0.5.9
Published
An AWS SQS client wrapped to provide consistent logging and other services.
Downloads
18
Readme
WrappedSqsClient
This package wraps the SQS Client - AWS SDK for JavaScript v3 to provide consistent logging and other services.
API Documentation
WrappedSqsClient
- WrappedSqsClient
- static
- .WrappedSqsClient
- new exports.WrappedSqsClient([options])
- instance
- .queueInitialized ⇒ boolean
- .queueName ⇒ string
- .queueUrl ⇒ string
- .createQueue(queueName, [attributes], [tags]) ⇒ Promise.<WrappedSqsClient>
- .deleteQueue() ⇒ Promise.<WrappedSqsClient>
- .deleteMessageBatch(messages) ⇒ Promise.<WrappedSqsClient>
- .getQueue(queueName) ⇒ Promise.<WrappedSqsClient>
- .getQueueAttributes([attributeNames]) ⇒ Promise.<object>
- .purgeQueue() ⇒ Promise.<WrappedSqsClient>
- .queueExists(queueName) ⇒ Promise.<boolean>
- .receiveMessages([options]) ⇒ Promise.<Array.<{messageId: string, body: any, attributes: Object.<string, string>}>>
- .sendMessage(options) ⇒ Promise.<WrappedSqsClient>
- .sendMessageBatch(entries) ⇒ Promise.<WrappedSqsClient>
- static
- .decodeMessage([message]) ⇒ object
- .decodeMessageAttributes(attributes) ⇒ DecodedMessageAttributes
- .encodeMessageAttributes(attributes) ⇒ EncodedMessageAttributes
- .WrappedSqsClient
- inner
- ~defaultClientConfig : SQSClientConfig
- ~DecodedMessageAttributes : Object.<string, (string|number)>
- ~EncodedMessageAttributes : Object.<string, MessageAttributeValue>
- ~SendMessageBatchRequestEntry : object
- static
WrappedSqsClient.WrappedSqsClient
Wraps an AWS SQS client to provide standard logging & services.
Kind: static class of WrappedSqsClient
- .WrappedSqsClient
- new exports.WrappedSqsClient([options])
- instance
- .queueInitialized ⇒ boolean
- .queueName ⇒ string
- .queueUrl ⇒ string
- .createQueue(queueName, [attributes], [tags]) ⇒ Promise.<WrappedSqsClient>
- .deleteQueue() ⇒ Promise.<WrappedSqsClient>
- .deleteMessageBatch(messages) ⇒ Promise.<WrappedSqsClient>
- .getQueue(queueName) ⇒ Promise.<WrappedSqsClient>
- .getQueueAttributes([attributeNames]) ⇒ Promise.<object>
- .purgeQueue() ⇒ Promise.<WrappedSqsClient>
- .queueExists(queueName) ⇒ Promise.<boolean>
- .receiveMessages([options]) ⇒ Promise.<Array.<{messageId: string, body: any, attributes: Object.<string, string>}>>
- .sendMessage(options) ⇒ Promise.<WrappedSqsClient>
- .sendMessageBatch(entries) ⇒ Promise.<WrappedSqsClient>
- static
- .decodeMessage([message]) ⇒ object
- .decodeMessageAttributes(attributes) ⇒ DecodedMessageAttributes
- .encodeMessageAttributes(attributes) ⇒ EncodedMessageAttributes
new exports.WrappedSqsClient([options])
WrappedSqsClient constructor.
| Param | Type | Description | | --- | --- | --- | | [options] | object | Options. | | [options.config] | SQSClientConfig | SQSClientConfig. | | [options.logger] | object | Logger instance (default is global console object). Must have info, error & debug methods | | [options.logInternals] | boolean | Log AWS client internals (default is false). | | [options.queueUrl] | string | SQS queue URL. |
wrappedSqsClient.queueInitialized ⇒ boolean
Returns true if queue has been initialized.
Kind: instance property of WrappedSqsClient
Returns: boolean - True if the queue has been initialized.
wrappedSqsClient.queueName ⇒ string
Gets queue name.
Kind: instance property of WrappedSqsClient
Returns: string - Queue name.
wrappedSqsClient.queueUrl ⇒ string
Gets the queue URL.
Kind: instance property of WrappedSqsClient
Returns: string - Queue URL.
wrappedSqsClient.createQueue(queueName, [attributes], [tags]) ⇒ Promise.<WrappedSqsClient>
Creates a new queue.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
| Param | Type | Description | | --- | --- | --- | | queueName | string | Queue name | | [attributes] | Object.<string, string> | CreateQueueCommandInput attributes | | [tags] | Object.<string, string> | CreateQueueCommandInput tags |
wrappedSqsClient.deleteQueue() ⇒ Promise.<WrappedSqsClient>
Deletes a queue.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
wrappedSqsClient.deleteMessageBatch(messages) ⇒ Promise.<WrappedSqsClient>
Deletes a message batch.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
| Param | Type | Description | | --- | --- | --- | | messages | Array.<object> | Messages to delete. |
wrappedSqsClient.getQueue(queueName) ⇒ Promise.<WrappedSqsClient>
Get existing queue by name.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
| Param | Type | Description | | --- | --- | --- | | queueName | string | Queue name. |
wrappedSqsClient.getQueueAttributes([attributeNames]) ⇒ Promise.<object>
Get queue attributes.
Kind: instance method of WrappedSqsClient
Returns: Promise.<object> - Queue attributes.
| Param | Type | Description | | --- | --- | --- | | [attributeNames] | Array.<string> | GetQueueAttributesCommand |
wrappedSqsClient.purgeQueue() ⇒ Promise.<WrappedSqsClient>
Purge queue.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
wrappedSqsClient.queueExists(queueName) ⇒ Promise.<boolean>
Test queue existence by name.
Kind: instance method of WrappedSqsClient
Returns: Promise.<boolean> - True if queue exists.
| Param | Type | Description | | --- | --- | --- | | queueName | string | Queue name. |
wrappedSqsClient.receiveMessages([options]) ⇒ Promise.<Array.<{messageId: string, body: any, attributes: Object.<string, string>}>>
Receive queue messages.
Kind: instance method of WrappedSqsClient
Returns: Promise.<Array.<{messageId: string, body: any, attributes: Object.<string, string>}>> - Array of messages.
| Param | Type | Description | | --- | --- | --- | | [options] | object | Options. | | [options.limit] | number | Maximum number of messages to receive. |
wrappedSqsClient.sendMessage(options) ⇒ Promise.<WrappedSqsClient>
Sends a message.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
| Param | Type | Description | | --- | --- | --- | | options | object | Options. | | options.body | * | SendMessageCommandInput messageBody. Must be a string or a JSON-serializable object. | | [options.deduplicationId] | string | SendMessageCommandInput messageDeduplicationId | | [options.delaySeconds] | number | Delay in seconds. | | [options.groupId] | string | SendMessageCommandInput messageGroupId | | [options.messageAttributes] | DecodedMessageAttributes | Message attributes. | | [options.systemAttributes] | DecodedMessageAttributes | SendMessageCommandInput messageSystemAttributes |
wrappedSqsClient.sendMessageBatch(entries) ⇒ Promise.<WrappedSqsClient>
Sends a message batch.
Kind: instance method of WrappedSqsClient
Returns: Promise.<WrappedSqsClient> - WrappedSqsClient instance.
| Param | Type | Description | | --- | --- | --- | | entries | Array.<SendMessageBatchRequestEntry> | Entries. |
WrappedSqsClient.decodeMessage([message]) ⇒ object
Decode message from SQS.
Kind: static method of WrappedSqsClient
Returns: object - Decoded message.
| Param | Type | Description | | --- | --- | --- | | [message] | object | Encoded message. |
WrappedSqsClient.decodeMessageAttributes(attributes) ⇒ DecodedMessageAttributes
Decode message attributes from SQS.
Kind: static method of WrappedSqsClient
Returns: DecodedMessageAttributes - Decoded message attributes.
| Param | Type | Description | | --- | --- | --- | | attributes | EncodedMessageAttributes | Encoded message attributes. |
WrappedSqsClient.encodeMessageAttributes(attributes) ⇒ EncodedMessageAttributes
Encode message attributes for SQS.
Kind: static method of WrappedSqsClient
Returns: EncodedMessageAttributes - Encoded message attributes.
| Param | Type | Description | | --- | --- | --- | | attributes | DecodedMessageAttributes | Decoded message attributes. |
WrappedSqsClient~defaultClientConfig : SQSClientConfig
Kind: inner constant of WrappedSqsClient
WrappedSqsClient~DecodedMessageAttributes : Object.<string, (string|number)>
Kind: inner typedef of WrappedSqsClient
WrappedSqsClient~EncodedMessageAttributes : Object.<string, MessageAttributeValue>
Kind: inner typedef of WrappedSqsClient
WrappedSqsClient~SendMessageBatchRequestEntry : object
Kind: inner typedef of WrappedSqsClient
Properties
| Name | Type | Description | | --- | --- | --- | | body | * | SendMessageCommandInput messageBody. Must be a string or a JSON-serializable object. | | [deduplicationId] | string | SendMessageCommandInput messageDeduplicationId | | [delaySeconds] | number | Delay in seconds. | | [groupId] | string | SendMessageCommandInput messageGroupId | | id | string | Message ID. | | [messageAttributes] | DecodedMessageAttributes | Message attributes. | | [systemAttributes] | DecodedMessageAttributes | SendMessageCommandInput messageSystemAttributes |
See more great templates and other tools on my GitHub Profile!