Alan Conway wrote:
LocalQueue and SubscriptionManager both have get() functions that take a
timeout. The timeout defaults to 0, so the default meaning of get is "if
there's a message immediately available, get it, else give up."
I'm responsible for that default but it now strikes me as completely
wrong. In an async messaging system you very rarely know when a message
is "there" you almost always want to wait for it.
TIME_INFINITE might be a more appropriate default, although there's a
risk of silently breaking existing code. Removing the default entirely
would give a compile error in existing code (which is better) and would
force the developer to be clear about what they want?
Anyone agree/disagree with changing or removing the default?
There are already two versions of those methods. One that throws an
error if a message doesn't show up in the specified time, the other
returning a boolean indicating success. The default on the former is
TIME_INFINITE, the default on the latter is 0 (i.e. check if the queue
has a message on it 'now'). Personally I find that reasonably intuitive...