npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@treedom/cdk-constructs-sqs-lambda

v1.0.0

Published

This package contains useful CDK constructs for integrating Amazon SQS with AWS Lambda.

Downloads

302

Readme

@treedom/cdk-constructs-sqs-lambda

This package contains useful CDK constructs for integrating Amazon SQS with AWS Lambda.

Made with ❤️ at  , join us in making a difference!

Installation

To install this package, run the following command:

npm install @treedom/cdk-constructs-sqs-lambda

API Reference

EventBridgeSqsLambda

The main construct provided by this package.

Constructor

new EventBridgeSqsLambda(scope: Construct, id: string, props: EventBridgeSqsLambdaProps)

Usage

This package provides the EventBridgeSqsLambda construct, which sets up an integration between EventBridge, SQS, and Lambda.

Here's a basic example of how to use the construct:

import { EventBridgeSqsLambda } from '@treedom/cdk-constructs-sqs-lambda';
import { Stack } from 'aws-cdk-lib';
import { Construct } from 'constructs';

class MyStack extends Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    new EventBridgeSqsLambda(this, 'MyEventBridgeSqsLambda', {
      envPrefix: 'myapp',
      ruleProps: {
        eventBus: myEventBus,
        eventPattern: {
          // Define your event pattern here
        },
      },
      nodejsFunctionProps: {
        // Define your Lambda function properties here
      },
    });
  }
}

Properties

  • deadLetterQueue: The dead-letter queue for the SQS queue.
  • readQueue: The main SQS queue.
  • eventSource: The SQS event source for the Lambda function.
  • rules: An array of EventBridge rules.
  • lambda: The NodeJS Lambda function.
  • envPrefix: The environment prefix used for naming resources.

Methods

  • addRule(ruleName: string, ruleProps: EventBridgeSqsLambdaRuleProps): Adds a new EventBridge rule to the construct.

EventBridgeSqsLambdaProps

The EventBridgeSqsLambdaProps interface includes the following properties:

  • queue: (Optional) Properties for the main SQS queue, including an optional retryAttempts number.
  • queueDlq: (Optional) Properties for the dead-letter queue.
  • rules: (Optional) Array of EventBridge rules configuration.
  • lambda: (Optional) Properties for the NodeJS Lambda function.
  • eventSource: (Optional) Properties for the SQS event source.
  • namesPrefix: (Optional) A string used as a prefix for naming resources.

LambdaMaxScalingAspect

This class implements the IAspect interface and can be used to verify if some lambdas exceed the maximum allowed concurrency. Default maximum concurrency is 10 if not specified. maximum scaling specified. If the limit is exceeded an error Annotation on the lambda will be emitted.

Usage

import { LambdaMaxScalingAspect } from '@treedom/cdk-constructs-sqs-lambda';

const maxScalingAspect = new LambdaMaxScalingAspect({maximumConcurrency: 50})

Aspects.of(this).add(maxScalingAspect);

Dependencies

This package depends on the following libraries:

  • @treedom/cdk-constructs-datadog: ^1.0.0
  • aws-cdk-lib: ^2.165.0
  • constructs: ^10.4.2

Make sure these dependencies are available in your project when using this package.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you find a bug or have a feature request, please file an issue on the GitHub repository.

🌳 Join Us in Making a Difference! 🌳

We invite all developers who use Treedom's open-source code to support our mission of sustainability by planting a tree with us. By contributing to reforestation efforts, you help create a healthier planet and give back to the environment. Visit our Treedom Open Source Forest to plant your tree today and join our community of eco-conscious developers.

Additionally, you can integrate the Treedom GitHub badge into your repository to showcase the number of trees in your Treedom forest and encourage others to plant new ones. Check out our integration guide to get started.

Together, we can make a lasting impact! 🌍💚