Skip to content

Provide a detached publication queue, on demand

Current situation

If a service or plugin want to publish events asynchronously, it has to implement its own mechanism.

Desired outcome

The toolkit should provide a helper that allow for that. It can handle any throttling/breaker mechanism, and should handle failed publication by repeating them.

The following code can now be used:

from opentf.commons import make_dispatchqueue

queue = make_dispatchqueue(app)

queue.put(event)

The publication is asynchronous, and in case of failure it is reattempted, with no limit. An increasing delay (delay = min(delay * 2 + 0.2, 60) is applied in case of failure (the delay is reinitialized after a successful publication).

Edited by Martin Lafaix