kynesim / kbus

Automatically exported from code.google.com/p/kbus
Other
5 stars 2 forks source link

Maybe allow a listener to only receive "the most recent message"? #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is a suggestion from Michel.

Imagine we have a sender who is sending "$.redraw" messages, each of which 
gives some parameter defining the redraw.

One can conceive of a listener who wishes only to hear the most recent 
redraw message - any messages they "miss" are not of interest.

Thus, if the sender sends:

* redraw 1
* redraw 2
* redraw 3

and the listener then does "get next message", it only wants to read the 
"redraw 3" message, and not the preceding (presumably now irrelevant) 
messages.

This can probably be emulated by just having a loop that reads until there 
are no more messages (and then "using" the last message), but that's 
clumsy, and probably error prone.

Considerations:

1. What happens if the sender flags the message with ALL_OR_WAIT or 
ALL_OR_FAIL (presumably this listener should not be considered when 
judging whether this message can be sent?)

2. What happens if one of the messages is marked URGENT?

Original issue reported on code.google.com by t...@tibsnjoan.co.uk on 18 Mar 2010 at 3:33

GoogleCodeExporter commented 9 years ago
This usage is typicaly used as generic notifications, when timing or importance 
is not strictly necessary. For 
example, a "New Mail" notification can be sent many times by the mail pooling 
daemon, and can trigger, much 
later, an action somewhere to redraw an icon.

It allows tasks to registrer interest, occasionaly.

Original comment by buser...@gmail.com on 23 Mar 2010 at 11:24