winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.06k stars 198 forks source link

cloud Topic should enable filtering by event payloads #5180

Open skorfmann opened 11 months ago

skorfmann commented 11 months ago

I tried this:

Applying a filter to onMessage so the subscription is invoked only on things I'm interested in

let foo = new cloud.Topic();

foo.onMessage(inflight () => {
  // code
});

This happened:

no option to define a filter

I expected this:

being able to subscribe to certain events only

Is there a workaround?

override it in platform

Anything else?

No response

Wing Version

0.51.7

Node.js Version

18.7

Platform(s)

MacOS

Community Notes

eladb commented 11 months ago

Can you provide some examples of filters? Are you thinking of something like:

topic.onMessage(match: "<some query language>", () => {
});
skorfmann commented 11 months ago

Can you provide some examples of filters? Are you thinking of something like:

topic.onMessage(match: "<some query language>", () => {
});

Something based on https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html would be good. In particular string matchers would go a long way already.

Can update with actual use-cases once I get to the implementation of where we're planning to use it.

Chriscbr commented 11 months ago

See also https://github.com/winglang/wing/issues/5209

github-actions[bot] commented 9 months ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!