Class InstrumentedTransport

java.lang.Object
jakarta.mail.Service
jakarta.mail.Transport
io.micrometer.jakarta9.instrument.mail.InstrumentedTransport
All Implemented Interfaces:
AutoCloseable

public class InstrumentedTransport extends jakarta.mail.Transport
Wraps a Transport so that it is instrumented with an Observation.
Since:
1.16.0
  • Field Summary

    Fields inherited from class jakarta.mail.Service

    debug, session, url
  • Constructor Summary

    Constructors
    Constructor
    Description
    InstrumentedTransport(jakarta.mail.Session session, jakarta.mail.Transport delegate, io.micrometer.observation.ObservationRegistry observationRegistry)
    Create an instrumented transport using the default ObservationConvention.
    InstrumentedTransport(jakarta.mail.Session session, jakarta.mail.Transport delegate, io.micrometer.observation.ObservationRegistry observationRegistry, @Nullable io.micrometer.observation.ObservationConvention<MailSendObservationContext> customConvention)
    Create an instrumented transport with a custom convention.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    connect(String host, int port, String user, String password)
     
    void
    sendMessage(jakarta.mail.Message msg, jakarta.mail.Address[] addresses)
     

    Methods inherited from class jakarta.mail.Transport

    addTransportListener, notifyTransportListeners, removeTransportListener, send, send, send, send

    Methods inherited from class jakarta.mail.Service

    addConnectionListener, connect, connect, connect, finalize, getURLName, isConnected, notifyConnectionListeners, protocolConnect, queueEvent, removeConnectionListener, setConnected, setURLName, toString

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • InstrumentedTransport

      public InstrumentedTransport(jakarta.mail.Session session, jakarta.mail.Transport delegate, io.micrometer.observation.ObservationRegistry observationRegistry)
      Create an instrumented transport using the default ObservationConvention.
      Parameters:
      session - session for the delegate transport
      delegate - transport to instrument
      observationRegistry - registry for the observations
    • InstrumentedTransport

      public InstrumentedTransport(jakarta.mail.Session session, jakarta.mail.Transport delegate, io.micrometer.observation.ObservationRegistry observationRegistry, @Nullable io.micrometer.observation.ObservationConvention<MailSendObservationContext> customConvention)
      Create an instrumented transport with a custom convention.
      Parameters:
      session - session for the delegate transport
      delegate - transport to instrument
      observationRegistry - registry for the observations
      customConvention - override the convention to apply to the instrumentation
  • Method Details

    • connect

      public void connect(String host, int port, String user, String password) throws jakarta.mail.MessagingException
      Overrides:
      connect in class jakarta.mail.Service
      Throws:
      jakarta.mail.MessagingException
    • sendMessage

      public void sendMessage(jakarta.mail.Message msg, jakarta.mail.Address[] addresses) throws jakarta.mail.MessagingException
      Specified by:
      sendMessage in class jakarta.mail.Transport
      Throws:
      jakarta.mail.MessagingException
    • close

      public void close() throws jakarta.mail.MessagingException
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class jakarta.mail.Service
      Throws:
      jakarta.mail.MessagingException