Add methods to register fallback handlers#581
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This all looks good to me but we tend to call these "dynamic" handlers in the other SDKs (though, I agree fallback probably makes more sense). I think we probably should name them that just to be consistent. As far as unsetting goes - yeah, I think that's reasonable to have. |
|
@Sushisource we already have methods like |
Right, in this case we would not take the name parameter, but would have the "dynamic" suffix. As for un-registering, after looking again other SDKs don't have it so we probably don't need that. |
What was changed
Added methods to define dynamic handlers for Signals, Updates, and Queries.
Workflow::registerDynamicQuery($handler)Workflow::registerDynamicSignal($handler)Workflow::registerDynamicUpdate($handler, $validator)Checklist
Documentation
Dynamic Signal Handler
You can register a Signal handler that will be called if a handler for a specific Signal is not found.
If by the time the dynamic handler is registered, the Workflow has already received unhandled Signals, they will be processed immediately in the order they were received.
Dynamic Query Handler
You can register a Query handler that will be called if a handler for a specific Query is not found.
Dynamic Update Handler
You can register an Update handler that will be called if a handler for a specific update is not found.
The
registerDynamicUpdate()method accepts two arguments: