How to populate a Multi from the contents of an actively changing Queue? #1562
Replies: 2 comments
-
Follow-up: I think I'm a lot closer. For now I've tried this:
My logic is that it appears Or, maybe I replace the
Apologies for the kind of slow stream-of-consciousness as I work through this problem. I didn't see a discussion of someone going through this, and I'm hoping my experience and any other feedback that's provided will prove helpful to someone else in the future. |
Beta Was this translation helpful? Give feedback.
-
Alright, so this still isn't working, and I don't know why. Here's my current code:
Here's the problem. I never see that |
Beta Was this translation helpful? Give feedback.
-
Here's my puzzle that I'm having trouble solving: I have a
BlockingQueue
that I'm interacting with that is periodically being added to by a very large and expensive operation with the result of that operation. Each time a result is added to thisBlockingQueue
, I'd like to also publish that result through an endpoint. Then my web page can asynchronously update the page based on each result as we get it.In general, it looks like the solution I want for this is to use Server-Sent Events. Sure, no problem. Except I'm not sure how to populate my
Multi
based on periodically checking if anything's been added to myBlockingQueue
on another thread yet.Is this something that's possible? Or do I need to emit the results stored in this Queue some other way? Either way, my goal is to emit each result as it comes in, rather than waiting for the potentially hundreds or thousands of results to slowly fill the Queue and returning the massive list of results at the end.
Thanks ahead of time.
Beta Was this translation helpful? Give feedback.
All reactions