Class MicrometerSupport

java.lang.Object
org.acemq.amqp.core.MicrometerSupport

public final class MicrometerSupport extends Object
Creates the Micrometer sink, in a class of its own.

The separation is load-bearing rather than tidy. A method that mentions a Micrometer type causes the JVM to resolve that type when the method first runs, before any guard inside the method can execute. Putting the reference in a separate class means the class is only loaded at the moment it is used, which is inside a branch that has already established Micrometer is present.

Getting this wrong does not degrade gracefully: it throws NoClassDefFoundError on the first connection in any application that chose not to depend on Micrometer.

  • Method Details

    • telemetry

      public static Telemetry telemetry(io.micrometer.core.instrument.MeterRegistry registry, String transport)
      Records AceMQ activity into a registry you supply.

      Preferable to auto-detection, which falls back to Micrometer's global registry: that is process-wide mutable state, so two connections cannot report separately and a test cannot isolate its own measurements.

      Parameters:
      registry - the registry to record into
      transport - transport short name, used as the messaging system tag
      Returns:
      a telemetry sink writing to that registry