Add "retroactivelySubscribe()" method in the PTT class of the PTT library

Description

This would save the client programmer some typing if he is also interested in notifications that occurred before any subscribers were available for a given key. Currently, the code needed to access the payload respectively cached for such notifications resembles the snippet below:

/**

  • Syntactic sugar. Subscribes given callback to given PTT key, also considering
    * "cached notifications" (notifications that occurred before any subscribers were
    * available; the last body/payload of such a notification gets cached and can
    * be retrieved by late subscribers by using dedicated API).
    */
    private function retroactivelySubscribe (keyName : String, callback : Function) : void {
    GLOBAL_PIPE.subscribe (keyName, callback);
    if (GLOBAL_PIPE.hasBackupFor(keyName)) {
    callback (GLOBAL_PIPE.recoverBackupFor(keyName));
    GLOBAL_PIPE.deleteBackupFor(keyName);
    }
    }

Assignee

Claudius Iacob

Reporter

Claudius Iacob

Labels

None

Fix versions

Priority

Medium
Configure