Record Class SubscriptionRecord

java.lang.Object
java.lang.Record
com.iizix.server.push.engine.store.SubscriptionRecord
Record Components:
uid - The user ID (UserInfoBase.id).
appId - The application ID as validated by Utilities.getValidName, or * for the iiziRun subscriptions of the server.
topic - The Topic, empty (never null) for the application-level subscription.
deviceUuid - The device UUID in canonical 36-character form.
transport - The transport, never null; a stored ordinal outside the constant set is never loaded as a record.
subId - The transport's subscription: the JSON of a browser PushSubscription for VAPID, the token string for FCM and APNS.
domain - The host name the client used to reach this server.
userAgent - The client's user agent string, may be empty.
created - Creation time, milliseconds since the epoch.
lastSeen - When the device last presented this subscription, milliseconds since the epoch.
lastIp - The remote address the device last presented, null when unknown.
region - The region code the last address resolved to, null when unknown or not yet resolved.

public record SubscriptionRecord(long uid, String appId, String topic, String deviceUuid, PushTransport transport, String subId, String domain, String userAgent, long created, long lastSeen, String lastIp, String region) extends Record
One row of the subscription table.
Author:
Christopher Mindus
  • Constructor Details

    • SubscriptionRecord

      public SubscriptionRecord(long uid, String appId, String topic, String deviceUuid, PushTransport transport, String subId, String domain, String userAgent, long created, long lastSeen, String lastIp, String region)
      Creates an instance of a SubscriptionRecord record class.
      Parameters:
      uid - the value for the uid record component
      appId - the value for the appId record component
      topic - the value for the topic record component
      deviceUuid - the value for the deviceUuid record component
      transport - the value for the transport record component
      subId - the value for the subId record component
      domain - the value for the domain record component
      userAgent - the value for the userAgent record component
      created - the value for the created record component
      lastSeen - the value for the lastSeen record component
      lastIp - the value for the lastIp record component
      region - the value for the region record component
  • Method Details

    • spoolKey

      public String spoolKey()
      Gets the spool key: what the spool stores for a pending delivery so that a replay can look this subscription up again by its identity and send to whatever endpoint it has then.
      Returns:
      uid|appId|topic|deviceUuid.
    • parseSpoolKey

      public static String[] parseSpoolKey(String key)
      Parses a spool key.
      Parameters:
      key - The key from spoolKey().
      Returns:
      The four parts: uid, appId, topic, deviceUuid; or null when the key is malformed.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uid

      public long uid()
      Returns the value of the uid record component.
      Returns:
      the value of the uid record component
    • appId

      public String appId()
      Returns the value of the appId record component.
      Returns:
      the value of the appId record component
    • topic

      public String topic()
      Returns the value of the topic record component.
      Returns:
      the value of the topic record component
    • deviceUuid

      public String deviceUuid()
      Returns the value of the deviceUuid record component.
      Returns:
      the value of the deviceUuid record component
    • transport

      public PushTransport transport()
      Returns the value of the transport record component.
      Returns:
      the value of the transport record component
    • subId

      public String subId()
      Returns the value of the subId record component.
      Returns:
      the value of the subId record component
    • domain

      public String domain()
      Returns the value of the domain record component.
      Returns:
      the value of the domain record component
    • userAgent

      public String userAgent()
      Returns the value of the userAgent record component.
      Returns:
      the value of the userAgent record component
    • created

      public long created()
      Returns the value of the created record component.
      Returns:
      the value of the created record component
    • lastSeen

      public long lastSeen()
      Returns the value of the lastSeen record component.
      Returns:
      the value of the lastSeen record component
    • lastIp

      public String lastIp()
      Returns the value of the lastIp record component.
      Returns:
      the value of the lastIp record component
    • region

      public String region()
      Returns the value of the region record component.
      Returns:
      the value of the region record component