Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional filtering on event.pattern #19

Open
qhello opened this issue Jul 26, 2022 · 0 comments
Open

Additional filtering on event.pattern #19

qhello opened this issue Jul 26, 2022 · 0 comments

Comments

@qhello
Copy link

qhello commented Jul 26, 2022

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 😊

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

No branches or pull requests

1 participant