Skip to content

Additional filtering on event.pattern #19

Description

@qhello

Hi @fredericbarthelet,

WDYT about adding optional additional filtering to event.pattern? This would allow to listen to a subset of event patterns.

Right now we're accomplishing it by doing something like this:

const eventBridgePattern: DeepPartial<Input> = {
  detail: { status: [RentalDeliveryStatus.DELIVERED] as unknown as Input['detail']['status'] }, // Make sure this value is somewhat linked to event type
};

...

events: [
    {
      eventBridge: {
        eventBus: 'bus',
        // Augmenting the default typebridge pattern, to only listen to events with status "DELIVERED"
        pattern: {
          ...event.pattern,
          ...eventBridgePattern,
        },
      },
    },
  ],

would be amazing in our use case to have something more like this: event.pattern({ status: "Delivered" })

let me know what you think, would be happy to create a PR regarding this 😊

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions