Class HandlerMonitor

java.lang.Object
io.fluxcapacitor.javaclient.tracking.metrics.HandlerMonitor
All Implemented Interfaces:
HandlerDecorator, HandlerInterceptor

public class HandlerMonitor extends Object implements HandlerInterceptor
  • Constructor Details

    • HandlerMonitor

      public HandlerMonitor()
  • Method Details

    • interceptHandling

      public Function<DeserializingMessage,Object> interceptHandling(Function<DeserializingMessage,Object> function, HandlerInvoker invoker)
      Description copied from interface: HandlerInterceptor
      Intercepts the message handling logic.

      The function parameter represents the next step in the handling chain— typically the actual message handler. The invoker provides metadata and invocation logic for the underlying handler method.

      Within this method, an interceptor may:

      • Modify the DeserializingMessage before 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:
      interceptHandling in interface HandlerInterceptor
      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
    • publishMetrics

      protected void publishMetrics(HandlerInvoker invoker, DeserializingMessage message, boolean exceptionalResult, Instant start, Object result)
    • formatType

      protected String formatType(DeserializingMessage message)
    • metricsDisabled

      protected boolean metricsDisabled(HandlerInvoker invoker)
    • logMetrics

      protected boolean logMetrics(HandlerInvoker invoker, HasMessage message)