Code Monkey home page Code Monkey logo

azure-queue-wrapper's Introduction

Azure Queue Wrapper for Node.js

This package provides a convenient wrapper for working with Azure Storage Queues in Node.js applications.

Installation

You can install the package using npm:

npm install azure-queue-wrapper

Usage

  1. Initialize Azure Queue Wrapper Import the package and initialize the Azure Queue Wrapper in your code:
const { ProcessAzureQueueMessage, AddMessageToQueue } = require('azure-queue-wrapper');
  1. Process Messages from Queue Use the @ProcessAzureQueueMessage decorator to process messages from a queue based on a specified time interval:
class MyQueueProcessor {
@ProcessAzureQueueMessage(connectionString,{ queue: 'my-queue', timeInterval: [5, 'seconds'], maxRetry: 3, deadLetterQueue: 'poison-queue-name' }) // Replace with your queue name, retries count(default: 3), interval (default:5 seconds) and deadLetterQueue name( default: <queue-name>-poison)
async processQueueMessage(message) { // Replace with your function name
// Your message processing logic here
}
}

Supported Time Units

The following time units are supported for specifying the time interval:

  • Seconds
  • Minutes
  • Hours
  • Days
  • Weeks

The time interval should be specified as a tuple with a numeric value and the unit, for example, (5, 'seconds') for 5 seconds, (10, 'minutes') for 10 minutes, and so on. 3. Add Message to Queue Use the @AddMessageToQueue decorator to add a message to a queue:

class MyQueueProducer {
@AddMessageToQueue(connectionString)
async addMessageToQueue(queueName, message) { // Your function name
// Your message adding logic here
return { status: 'success' };
}
}

Contributing Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.

License

This project is licensed under the MIT License.

azure-queue-wrapper's People

Contributors

the-arijit-ray avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.