colinl / node-red-guaranteed-delivery

A node-red node to facilitate guaranteed delivery of messages (upload, email, MQTT etc) across a network
Apache License 2.0
0 stars 0 forks source link

[Feature] Stack order #2

Open rept0id opened 4 months ago

rept0id commented 4 months ago

Hello!,

It would be nice if there were a way to select the order of accessing data from the buffer.

At present, the buffer is treated solely as a queue. However, some people might value the newest messages more than the oldest messages - while still wanting to transact all messages, for historical logging purposes. In this example, treating the data conditionally as a stack would be beneficial.

I'm looking forward to examining this idea further if you see its value.

Thank you, Rantouan Achmet

colinl commented 4 months ago

some people might value the newest messages more than the oldest

I have difficulty seeing that it makes much difference. Once the network is back up one would expect the queue to be flushed in a few seconds anyway.

colinl commented 4 months ago

Also consider this situation. Suppose the network is down and 50 messages become queued. Then the network recovers and the first 25 are flushed. Then suppose a new message comes in. This would be added to the queue, but since messages are being flushed newest first it would be the next message sent, followed by the other 25. The result would be that the messages were jumbled up.