mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-22 20:28:18 +00:00
929d51deba
Previously, we'd restrict `kumo.on` to allowing just a single instance of an event to be registered. The purpose of this was to help surface logical errors where copypasta would result in a bogus configuration. With multiple helper lua modules now wanting to take responsibility for some portion of the event handling, it is becoming more complex to stitch things together. It is desirable to allow multiple handlers for certain events, so that a module can handle just its area of responsibility without worry other modules about it. This commit introduces a CallbackSignature type that allows defining the function signature for event callbacks. The signature can be pre-created and registered ahead of setting up any lua contexts, which allows declaring whether an event can have multiple callbacks registered. The `get_queue_config` event handler has been set to allow multiple callbacks.
1.1 KiB
1.1 KiB
kumo.on('get_queue_config', function(domain, tenant, campaign, routing_domain))
!!! note This event handler is in flux and may change significantly
Not the final form of this API, but this is currently how we retrieve configuration used for managing a queue.
The parameters correspond to the domain, tenant, campaign and routing_domain
fields from the scheduled queue name, as discussed in Queues.
kumo.on(
'get_queue_config',
function(domain_name, tenant, campaign, routing_domain)
return kumo.make_queue_config {
max_retry_interval = '20 minutes',
}
end
)
See also kumo.make_queue_config.
{{since('dev', indent=True)}}
It is now possible to use kumo.on to register multiple handlers for
this event. The handlers will be called in the order that they were
registered. If a handler returns nil then the next handler will be
called. Conversely, if a handler returns a queue configuration object,
no further handlers will be called.
This behavior is intended to make it easier to compose multiple helpers
or lua modules together.