Class HandlerMonitor
java.lang.Object
io.fluxzero.sdk.tracking.metrics.HandlerMonitor
- All Implemented Interfaces:
HandlerDecorator, HandlerInterceptor
-
Nested Class Summary
Nested classes/interfaces inherited from interface HandlerDecorator
HandlerDecorator.MergedDecoratorNested classes/interfaces inherited from interface HandlerInterceptor
HandlerInterceptor.InterceptedHandler -
Field Summary
Fields inherited from interface HandlerDecorator
noOp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringformatType(DeserializingMessage message, HandlerInvoker invoker) interceptHandling(Function<DeserializingMessage, Object> function, HandlerInvoker invoker) Intercepts the message handling logic.protected booleanlogMetrics(HandlerInvoker invoker, HasMessage message) protected booleanmetricsDisabled(HandlerInvoker invoker) protected voidpublishMetrics(HandlerInvoker invoker, DeserializingMessage message, boolean exceptionalResult, Instant start, Object result) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HandlerDecorator
andThenMethods inherited from interface HandlerInterceptor
wrap
-
Constructor Details
-
HandlerMonitor
public HandlerMonitor()
-
-
Method Details
-
interceptHandling
public Function<DeserializingMessage, Object> interceptHandling(Function<DeserializingMessage, Object> function, HandlerInvoker invoker) Description copied from interface:HandlerInterceptorIntercepts the message handling logic.The
functionparameter represents the next step in the handling chain— typically the actual message handler. Theinvokerprovides metadata and invocation logic for the underlying handler method.Within this method, an interceptor may:
- Modify the
DeserializingMessagebefore passing it to the handler - Bypass the handler entirely and return a value directly
- Wrap the result after the handler is invoked
Note: Interceptors may return a different
DeserializingMessage, but it must be compatible with a handler method in the same target class. If no suitable handler is found, an exception will be thrown.- Specified by:
interceptHandlingin interfaceHandlerInterceptor- Parameters:
function- the next step in the handler chain (typically the handler itself)invoker- the metadata and execution strategy for the actual handler method- Returns:
- a decorated function that wraps handling behavior
- Modify the
-
publishMetrics
protected void publishMetrics(HandlerInvoker invoker, DeserializingMessage message, boolean exceptionalResult, Instant start, Object result) -
formatType
-
metricsDisabled
-
logMetrics
-