Socket
Socket
Sign inDemoInstall

azure-abstract-queue-adapter

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    azure-abstract-queue-adapter

Abstract Queue Adapter for Azure Storage Queue and Azure Message Bus


Version published
Maintainers
1
Install size
198 MB
Created

Readme

Source

azure-abstract-queue-adapter

Setup / Required Envs:

For Azure Storage Queue

export AZURE_STORAGE_ACCOUNT='...'
export AZURE_STORAGE_ACCESS_KEY='...'
export AZURE_STORAGE_CONNECTION_STRING='...'

For Azure Message Service Bus

export AZURE_SERVICEBUS_CONNECTION_STRING='...'

To Install

Install with npm install

npm install --save azure-abstract-queue-adapter

To Use

Include the library

var AzureAbstractQueueAdapter = require('azure-abstract-queue-adapter');

Get an adapter to use

Storage Queue
var queueAdapterA = new AzureAbstractQueueAdapter('azureStorageQueue');
Azure Service Bus
var queueAdapterB = new AzureAbstractQueueAdapter('azureServiceBusMessage');

Create Message

Create Message with JSON
async function createMessage(){
    await queueAdapterA.createJsonMessage(
        'myQueue', 
        {name: 'aaa', value: 'bbb'},
        'myQueueMessageId123' // optional...
    )
}
Create Message with plain string
async function createMessage(){
    await queueAdapterA.createPlainMessage(
        'myQueue',
        'myQueueMessage',
        'myQueueMessageId123' // optional...
    )
}

Receive Message

try{
    const { messageJson, messageText} = await queueAdapterA.getMessage(dlqName);
    // queue message is popped...
} catch(e){
    // queue is empty
}

Reference

createQueue
    Inputs:
        queueName
        queueOptions
    Outputs:
        Promise
...
createPlainMessage
    Inputs:
        queueName
        queueMessage
        queueMessageId
    Outputs:
        Promise

createJsonMessage
    Inputs:
        queueName
        queueMessage
        queueMessageId
    Outputs:
        Promise
...
getMessage
    Inputs:
        queueName
    Outputs:
        Promise
            messageText
            messageJson

FAQs

Last updated on 31 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc