07-05-2024 05:10 AM
Hi,
is there any option to deque data to multiple while loops parallelly without any loss?
Thanks
Kumaresan
Solved! Go to Solution.
07-05-2024 05:26 AM - edited 07-05-2024 05:33 AM
Hi Kumaresan,
If you need to broadcast data, you should try using User Event:
07-05-2024 06:21 AM
Hi Kumaresan,
@Kumaresan.mech wrote:
is there any option to deque data to multiple while loops parallelly without any loss?
Please define "without any loss" more precisely!
I have done "one producer, multiple consumer" to handle work load items in parallel using a queue: this way you can have "multiple workers" doing work as long as there are items in the queue. There was "no loss" of work items, but they might be executed in a different order than was used when placing them into the queue…
07-05-2024 07:47 AM
@Kumaresan.mech ha scritto:
Hi,
is there any option to deque data to multiple while loops parallelly without any loss?
Thanks
Kumaresan
The short answer is no. So you want to process the very same data in two independent loops? If you eplain why, someone could come up with a solution?
07-05-2024 07:55 AM
@Kumaresan.mech wrote:
Hi,
is there any option to deque data to multiple while loops parallelly without any loss?
Thanks
Kumaresan
If you want to use queues you could use a second queue which forwards the data from consumer 1 to consumer 2.
07-05-2024 08:21 AM - edited 07-05-2024 08:22 AM
@Kumaresan.mech wrote:
Hi,
is there any option to deque data to multiple while loops parallelly without any loss?
Thanks
Kumaresan
It depends how exactly you should process your data.
For example, if you need to handle some data in first loop and some in second, then nothing will wrong with dequeue in both loops from the same queue:
No data loss will occur, if one loop is faster than another, then he will process more data than another.
On the other hand, if you need to proceed same data in both loops, then you can use second queue and reinsert data (before or after processing):
Also in this case no data loss will occur.
07-05-2024 08:50 AM
Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...
The first response in msg #2 by PinguX is what I would recommend. It expands to 3rd and 4th consumers more simply and naturally. I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).
-Kevin P
07-05-2024 08:59 AM
@Kevin_Price ha scritto:
Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...
The first response in msg #2 by PinguX is what I would recommend. It expands to 3rd and 4th consumers more simply and naturally. I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).
-Kevin P
What happens if events build up? Are they stacked?
07-05-2024 09:10 AM
@pincpanter a écrit :
@Kevin_Price ha scritto:
Supposing you want both consumer loops to get a lossless stream of *all* the data enqueued by the producer...
The first response in msg #2 by PinguX is what I would recommend. It expands to 3rd and 4th consumers more simply and naturally. I'm just pointing it out again before it gets lost amidst other responses (which are not bad or wrong, just not as straightforward IMO).
-Kevin P
What happens if events build up? Are they stacked?
mcduff shared examples of User Events uses recently, here.
07-05-2024 11:09 AM
@pincpanter wrote:
What happens if events build up? Are they stacked?
Events are stored like a queue with a caveat, the mailbox, "the event structure", needs to be registered before any events are sent. If events are sent before the Event Structure is registered for the event, then they are lost.