Class ConnectionEvent

java.lang.Object
com.lucimber.dbus.connection.ConnectionEvent

public final class ConnectionEvent extends Object
Represents a connection lifecycle event.

Connection events are fired when the connection state changes, health checks succeed or fail, or other significant connection-related events occur.

  • Method Details

    • builder

      public static ConnectionEvent.Builder builder(ConnectionEventType type)
      Creates a new builder for constructing connection events.
      Parameters:
      type - The type of event
      Returns:
      A new builder instance
    • stateChanged

      public static ConnectionEvent stateChanged(ConnectionState oldState, ConnectionState newState)
      Creates a state change event.
      Parameters:
      oldState - The previous connection state
      newState - The new connection state
      Returns:
      A state change event
    • healthCheckSuccess

      public static ConnectionEvent healthCheckSuccess()
      Creates a health check success event.
      Returns:
      A health check success event
    • healthCheckFailure

      public static ConnectionEvent healthCheckFailure(Throwable cause)
      Creates a health check failure event.
      Parameters:
      cause - The cause of the health check failure
      Returns:
      A health check failure event
    • reconnectionAttempt

      public static ConnectionEvent reconnectionAttempt(int attemptNumber)
      Creates a reconnection attempt event.
      Parameters:
      attemptNumber - The reconnection attempt number
      Returns:
      A reconnection attempt event
    • getType

      public ConnectionEventType getType()
    • getOldState

      public Optional<ConnectionState> getOldState()
    • getNewState

      public Optional<ConnectionState> getNewState()
    • getTimestamp

      public Instant getTimestamp()
    • getMessage

      public Optional<String> getMessage()
    • getCause

      public Optional<Throwable> getCause()
    • toString

      public String toString()
      Overrides:
      toString in class Object