1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

extension: Make AfterMessageStored async (#319)

This commit is contained in:
James Hillyerd
2023-01-22 16:26:52 -08:00
committed by GitHub
parent b383fbf9ab
commit e74efbaa77
4 changed files with 24 additions and 7 deletions

View File

@@ -10,8 +10,17 @@ type Host struct {
}
// Events defines all the event types supported by the extension host.
//
// Before-events provide an opportunity for extensions to alter how Inbucket responds to that type
// of event. These events are processed synchronously; expensive operations will reduce the
// perceived performance of Inbucket. The first listener in the list to respond with a non-nil
// value will determine the response, and the remaining listeners will not be called.
//
// After-events allow extensions to take an action after an event has completed. These events are
// processed asynchronously with respect to the rest of Inbuckets operation. However, an event
// listener will not be called until the one before it complets.
type Events struct {
MessageStored EventBroker[event.MessageMetadata, Void]
AfterMessageStored EventBroker[event.MessageMetadata, Void]
}
// Void indicates the event emitter will ignore any value returned by listeners.