Around Advices
Last updated
Last updated
Around advices are the most powerful of all as you completely hijack the requested action with your own action that looks, smells and feels exactly as the requested action. This is usually referred to as a proxy design pattern.
This will allow you to run both before and after advices but also surround the method call with whatever logic you want like transactions
, try/catch
blocks, locks
or even decide to NOT execute the action at all.
You can do it globally by using the aroundHandler()
method or targeted to a specific action around{actionName}()
.
Examples
The arguments received by these interceptors are:
event
: The request context reference
targetAction
: The function pointer to the action that got the around interception. It will be your job to execute it (Look at samples)
eventArguments
: The struct of extra arguments sent to an action if any
rc
: The RC reference
prc
: The PRC Reference
You can fine tune these interception methods by leveraging two public properties in the handler:
this.aroundhandler_only
: A list of actions that the aroundHandler()
action will fire ONLY!
this.aroundhandler_except
: A list of actions that the aroundHandler()
action will NOT fire on