Replies: 4 comments 11 replies
-
|
@ekeren - the last line of the 2nd code sample should be |
Beta Was this translation helpful? Give feedback.
-
|
If I understand correctly, there's two issues being discussed - one is whether any function resource added/attached by The first issue is pretty straight forward - I totally agree, currently the way the resource is generated as a child of the queue doesn't totally make sense. Luckily this is a pretty easy fix. I'll write up a PR to update this. The second issue is a bit more tricky. In an early iteration of the Queue resource, we actually did have the TL;DR - subscribing to the events of a queue or other resource usually means there needs to exist code somewhere to convert from a cloud provider's native event structures (like SQSEvent) to the Wing SDK types. The most straightforward way to do this is to add a wrapper to the user's code to preprocess inputs, but this would require modifying user's code, and changing the effective type of the user's resource from |
Beta Was this translation helpful? Give feedback.
-
|
I think we need both options: one that you to "bring your own worker" (
As for resource scoping for the implicit P.S. We should have a deeper discussion on our event-driven API pattern as part of a Wing SDK RFC. @Chriscbr I know that @staycoolcall911 and you discussed kicking off this RFC, and I think we are ready to write it, and that it will really help bring up all these topics with a holistic view of the entire surface area. |
Beta Was this translation helpful? Give feedback.
-
|
Let's fold this discussion into #858 ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We have the following code in our examples:
The structure that it currently produces in the console is:
Meaning that the cloud function that saves the file on the bucket is a child of the queue.
I think that it is more correct that a queue is just a leaf, and doesn’t own the cloud function, I believe that the proper representation of this hierarchy should be:
Which means that the on_message function should not accept an
inflight function, it should accept acloud.Functionand the queue
on_messageproperty is set to thatcloud.Functionbut the queue itself is not the functions' parentA more descriptive way to write the above code will be:
And the corresponding hierarchy will be:
The queue itself is just an entry point to this greeting system, it should not contain the actual logic.
Beta Was this translation helpful? Give feedback.
All reactions