public interface SourceInterceptor
SOURCE component. Implementations may implement the beforeCallback method and the afterCallback method (by
default, beforeCallback and
afterCallback do nothing).
Interceptable components are those that are defined by a configuration element and have a ComponentLocation.
Each component for which a SourceInterceptor is applicable will have its own instance of that
SourceInterceptor. For instance, assuming there is a class MyInterceptor that implements
SourceInterceptor and 2 different components for which MyInterceptor is applicable, there will be 2 different
instances of MyInterceptor, one intercepting each of the component. Since different executions on the same processor
will use the same interceptor, it is advisable for implementations to be stateless.
A component may have more than one interceptor applied. In that case, all will be applied in a predetermined order, calling the
beforeCallback methods of each and finally the
afterCallback methods.
| Modifier and Type | Method and Description |
|---|---|
default void |
afterCallback(ComponentLocation location,
InterceptionEvent event,
Optional<Throwable> thrown)
This method is called after the intercepted source sends its response after a flow execution is complete.
|
default void |
afterTerminated(ComponentLocation location,
EventContext rootEventContext)
This method is called when the root
EventContext is terminated (all the event contexts of that event are completed)
regardless of whether the events finished successfully, on error, or a combination of both. |
default void |
beforeCallback(ComponentLocation location,
Map<String,ProcessorParameterValue> parameters,
InterceptionEvent event)
This method is called before the intercepted source sends its response after a flow execution is complete.
|
default void beforeCallback(ComponentLocation location, Map<String,ProcessorParameterValue> parameters, InterceptionEvent event)
event.location - the location and identification properties of the intercepted component in the mule app configuration.parameters - the parameters of the component as defined in the configuration. All the values are lazily evaluated so
they will be calculated when ProcessorParameterValue.resolveValue() method gets invoked.event - an object that contains the state of the event to be sent to the component. It may be modified by calling
its mutator methods.default void afterCallback(ComponentLocation location, InterceptionEvent event, Optional<Throwable> thrown)
If the intercepted source callback fails, the after
methods will still be called, with the thrown exception provided in the thrown parameter.
If before throws an Exception, the interception
will be called there, but the afters of the already
called handlers will still be called.
location - the location and identification properties of the intercepted component in the mule app configuration.event - the result of the component.thrown - the exception thrown by the intercepted component, if any.default void afterTerminated(ComponentLocation location, EventContext rootEventContext)
EventContext is terminated (all the event contexts of that event are completed)
regardless of whether the events finished successfully, on error, or a combination of both.location - the location and identification properties of the intercepted component in the mule app
configuration.rootEventContext - of the component result.Copyright © 2024 MuleSoft, Inc.. All rights reserved.