Interface ApnsClientMetricsListener


public interface ApnsClientMetricsListener

A metrics listener receives events from an ApnsClient that can be used to measure the performance and behavior of the client. Although the information sent to a metrics listener is generally available by other means, it is provided to listeners in a simplified form for ease of consumption and aggregation.

The information provided to metrics listeners is intended only to measure the performance and behavior of an ApnsClient; metrics listeners should never be used to drive business logic.

Implementations of the ApnsClientMetricsListener interface should expect to receive calls from multiple threads, and should take appropriate measures to ensure thread-safety.

Since:
0.6
Author:
Jon Chambers
See Also:
ApnsClientBuilder.setMetricsListener(ApnsClientMetricsListener)
  • Method Summary

    Modifier and Type Method Description
    void handleConnectionAdded​(ApnsClient apnsClient)
    Indicates that the client has successfully created a new connection to the APNs server in its internal connection pool.
    void handleConnectionCreationFailed​(ApnsClient apnsClient)
    Indicates that an attempt to create a new connection to the APNs server failed.
    void handleConnectionRemoved​(ApnsClient apnsClient)
    Indicates that the client has removed a previously-added connection from its internal connection pool.
    void handleNotificationAccepted​(ApnsClient apnsClient, long notificationId)
    Indicates that a notification that was previously sent to an APNs server was accepted by the server.
    void handleNotificationRejected​(ApnsClient apnsClient, long notificationId)
    Indicates that a notification that was previously sent to an APNs server was rejected by the server.
    void handleNotificationSent​(ApnsClient apnsClient, long notificationId)
    Indicates that a notification was sent to the APNs server.
    void handleWriteFailure​(ApnsClient apnsClient, long notificationId)
    Indicates that an attempt to send a push notification failed before the notification was processed by the APNs server.
  • Method Details

    • handleWriteFailure

      void handleWriteFailure​(ApnsClient apnsClient, long notificationId)
      Indicates that an attempt to send a push notification failed before the notification was processed by the APNs server. Write failures may be the first event in a sequence for a given notification ID (indicating that the notification was never written to the wire), but may also occur after a notification was sent if the connection closed before the notification was acknowledged by the server.
      Parameters:
      apnsClient - the client that sent the notification
      notificationId - an opaque identifier for the push notification that can be used to correlate this event with other events related to the same notification
      Since:
      0.6
    • handleNotificationSent

      void handleNotificationSent​(ApnsClient apnsClient, long notificationId)
      Indicates that a notification was sent to the APNs server. Note that a sent notification may still be either accepted or rejected by the APNs server later; sending the notification doesn't imply anything about the ultimate state of the notification.
      Parameters:
      apnsClient - the client that sent the notification
      notificationId - an opaque identifier for the push notification that can be used to correlate this event with other events related to the same notification
      Since:
      0.6
    • handleNotificationAccepted

      void handleNotificationAccepted​(ApnsClient apnsClient, long notificationId)
      Indicates that a notification that was previously sent to an APNs server was accepted by the server.
      Parameters:
      apnsClient - the client that sent the notification
      notificationId - an opaque identifier for the push notification that can be used to correlate this event with other events related to the same notification
      Since:
      0.6
    • handleNotificationRejected

      void handleNotificationRejected​(ApnsClient apnsClient, long notificationId)
      Indicates that a notification that was previously sent to an APNs server was rejected by the server.
      Parameters:
      apnsClient - the client that sent the notification
      notificationId - an opaque identifier for the push notification that can be used to correlate this event with other events related to the same notification
      Since:
      0.6
    • handleConnectionAdded

      void handleConnectionAdded​(ApnsClient apnsClient)
      Indicates that the client has successfully created a new connection to the APNs server in its internal connection pool.
      Parameters:
      apnsClient - the client that created the new connection
      Since:
      0.11
    • handleConnectionRemoved

      void handleConnectionRemoved​(ApnsClient apnsClient)
      Indicates that the client has removed a previously-added connection from its internal connection pool.
      Parameters:
      apnsClient - the client that removed the connection
      Since:
      0.11
    • handleConnectionCreationFailed

      void handleConnectionCreationFailed​(ApnsClient apnsClient)
      Indicates that an attempt to create a new connection to the APNs server failed.
      Parameters:
      apnsClient - the client that attempted to create a new connection
      Since:
      0.11