I have found myself with the need to send notifications, or tickle, certain entities when an expected event has not taken place.
In asynchronous worlds, things can happen whenever they happen; in synchronous worlds, things proceed in lockstep. The real world embodies both extremes, and all the places inbetween. Tickling is predicated on an inverse relationship between asynchronicity and expected sequence. When things happen in a 100% predictable order, asynchronicity is zero. When asynchronicity it at 100%, no order can be expected.
For instance, consider online shopping deliveries. Typically an order is expected within a particular wait time. As more wait time elapses between the passed expected time and the now, the situation tending to asynchronicity, the greater the sense of urgency - something surely should have happened by now!
A tickle is simply a notification that we’re waiting, and wouldn’t you mind hurrying it up already please? It’s a request for either information or the expected event. The notification may be a light touch to get some attention, a tap on the shoulder, a pinch, or even a smack on the top of the head. My task is to determine a reasonable system for tickling using the correct touch at the correct time.
There are five basic objects in the system - a tickle that happens at some time, the method used to do the tickle, the set of handlers that can respond to the tickle, the targeted set of things that are being tickled about, and working along side these objects, an urgency function that takes the maximum severity of the target set and determines the particular method needed to execute the tickle - a light touch or a slap.
To make things more concrete,
Tickle | tickled_at, tickle_method |
Tickle_Method | name, severity_threshold |
Tickle_Handler | tickle, handler_type, handler |
Tickle_Target | tickle, target_type, target, severity |
Urgency | tickle_targets, tickle_methods |
At some time, the Urgency is evaluated in the context of a set of tickle targets and a value is generated that indicates a tickle method should be exercised. A tickle is created and attached to the tickle targets and handlers, and finally a notification is sent to the handlers using the identified tickle method.
This information should persist until the next time for a tickle comes around. The severity of a tickle target rises both as the time gets later and the number of attempted notifications grows. Eventually the tickling may become so elevated that alarms go off and the authorities are called to begin searching for the missing body and prime suspects.