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

cloud.Queue.pop() #1385

Closed
Tracked by #1286
staycoolcall911 opened this issue Jan 31, 2023 · 9 comments · Fixed by #2506
Closed
Tracked by #1286

cloud.Queue.pop() #1385

staycoolcall911 opened this issue Jan 31, 2023 · 9 comments · Fixed by #2506
Assignees
Labels
good first issue Good for newcomers 🎨 sdk SDK

Comments

@staycoolcall911
Copy link
Contributor

staycoolcall911 commented Jan 31, 2023

https://docs.winglang.io/reference/wingsdk-spec#queue

@Bharadwajshivam28
Copy link

https://docs.winglang.io/reference/wingsdk-spec#queue

Assign it to me sir I want to work on it

@Bharadwajshivam28
Copy link

https://docs.winglang.io/reference/wingsdk-spec#queue

And please elaborate this issue

@Chriscbr
Copy link
Contributor

@Bharadwajshivam28 This issue is about implementing the pop inflight method described in the spec. Right now it says it "Pops (deletes and returns) a message from the queue". Here's an example of how it would be used in Wing:

bring cloud;

let q = new cloud.Queue();

new cloud.Function(inflight () => {
  q.push("hello");
  q.push("world");
  let item = q.pop();
  // Right now we are not assuming the queue is FIFO
  assert(item == "hello" || item == "world");
}) as "test";

Here's an example of a PR that added two inflight methods whose code could be helpful to look at as a reference https://github.com/winglang/wing/pull/1712/files

@Bharadwajshivam28
Copy link

okay

@Bharadwajshivam28
Copy link

@Bharadwajshivam28 This issue is about implementing the pop inflight method described in the spec. Right now it says it "Pops (deletes and returns) a message from the queue". Here's an example of how it would be used in Wing:

bring cloud;

let q = new cloud.Queue();

new cloud.Function(inflight () => {
  q.push("hello");
  q.push("world");
  let item = q.pop();
  // Right now we are not assuming the queue is FIFO
  assert(item == "hello" || item == "world");
}) as "test";

Here's an example of a PR that added two inflight methods whose code could be helpful to look at as a reference https://github.com/winglang/wing/pull/1712/files

thanks

@Bharadwajshivam28
Copy link

@Chriscbr can you please drop a short demo video .. like then it will be good for me work .. if you can then please

@Chriscbr
Copy link
Contributor

Hey @Bharadwajshivam28 - I highly recommend you first check out our development guide! It will guide you on how to build our monorepo, which contains all of the code for the Wing compiler toolchain. We are still working on improving this guide, so if you run into errors or problems getting the project to build locally, please let us know since it's still changing. 🙂

@Bharadwajshivam28
Copy link

Hey @Bharadwajshivam28 - I highly recommend you first check out our development guide! It will guide you on how to build our monorepo, which contains all of the code for the Wing compiler toolchain. We are still working on improving this guide, so if you run into errors or problems getting the project to build locally, please let us know since it's still changing. 🙂

Okay thanks

@mergify mergify bot closed this as completed in #2506 May 15, 2023
mergify bot pushed a commit that referenced this issue May 15, 2023
This code change adds support for sim and aws targets. Besides, it updates the spec to return an optional instead as proposed in #2284.

Closes #1385 and #2284

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.17.9.

mergify bot pushed a commit that referenced this issue Sep 14, 2023
Related to #3897

We have a flakey test in our CI that validates part of the functionality of `cloud.Queue`. It turns out, our test was assuming that the queue messages are received in FIFO order (first-in-first-out), which wasn't something we meant to guarantee (see the original issue about `queue.pop()` [here](#1385)). This PR fixes the test, and updates the simulator implementation to reflect the fact that messages can be received out of order.

(Why not FIFO by default? For many distributed apps, the exact order of messages isn't critical, and relaxing this constraint makes it easier to handle higher throughputs of messages. That said, adding a `fifo` option to `cloud.Queue` would be reasonable as a future enhancement)

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers 🎨 sdk SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants