Skip to content

Conversation

@brandomeniconi
Copy link
Member

@brandomeniconi brandomeniconi commented Dec 2, 2024

BRAKING CHANGE! this will be version 1.0.0

The initial release (v0.0.1) is compatible with current implementations. This new one drops some ad-hoc configurations to be more general-purpose but is incompatible with the previous version. The props have been simplified and made more flexible.

Feats:

  • resource naming was fixed and improved, no more repeated names. Outside-the-box default management.
  • rules are always passed as an array, this simplifies typings. It only adds a few braces in single-rule implementation ;)
  • adds some global default management for projects where there is a need for shared properties (es lambda config).

Example:

  // this sets the defaults for all implementations
  EventBridgeSqsLambda.setDefaults({
    lambda: {
      architecture: Architecture.ARM_64,
      runtime: Runtime.NODEJS_20_X,
    },
    namesPrefix: "test", // your env prefix
  });

  new EventBridgeSqsLambda(testStack, "TestConstruct", {
    rules: [
      {
        ruleName: "TestRule",
        eventBus: EventBus.fromEventBusName(testStack, "EventBus", `mybus`),
        eventPattern: {
          detailType: ["MyEvent"],
        },
      },
    ],
    lambda: {
      entry: path.join(__dirname, "./lambda.js"),
    },
  });

  new EventBridgeSqsLambda(testStack, "TestConstruct2", {
    rules: [
      {
        ruleName: "TestRule2",
        eventBus: EventBus.fromEventBusName(testStack, "EventBus", `mybus`),
        eventPattern: {
          detailType: ["MyEvent2"],
        },
      },
    ],
    lambda: {
      entry: path.join(__dirname, "./lambda2.js"),
    },
  });

they will both run in nodejs 20 (ARM) and have all resource names prefixed with test-.

@brandomeniconi brandomeniconi marked this pull request as ready for review December 2, 2024 16:29
@brandomeniconi brandomeniconi merged commit 96b2b53 into main Dec 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants