Record Class TransportResult

java.lang.Object
java.lang.Record
com.iizix.server.push.engine.transport.TransportResult
Record Components:
outcome - The outcome, never null.
status - The HTTP status the push service answered, 0 when no reply.
detail - A diagnostic, never null; empty for a plain success.
retryAfterMillis - The delay the service asked for before a retry, 0 for none.

public record TransportResult(DeliveryOutcome outcome, int status, String detail, long retryAfterMillis) extends Record
The result of one transport send.

The outcome is one of DeliveryOutcome.DELIVERED (the push service accepted the message), DeliveryOutcome.ENDPOINT_STALE (the service says the subscription is gone: prune it), DeliveryOutcome.SPOOLED (a transient failure: the engine spools and retries, honouring retryAfterMillis when the service gave one), DeliveryOutcome.TRANSPORT_REJECTED (permanent, do not retry) or DeliveryOutcome.TRANSPORT_NOT_CONFIGURED.

Author:
Christopher Mindus
  • Constructor Details

    • TransportResult

      public TransportResult(DeliveryOutcome outcome, int status, String detail, long retryAfterMillis)
      Creates an instance of a TransportResult record class.
      Parameters:
      outcome - the value for the outcome record component
      status - the value for the status record component
      detail - the value for the detail record component
      retryAfterMillis - the value for the retryAfterMillis record component
  • Method Details

    • of

      public static TransportResult of(DeliveryOutcome outcome, int status, String detail)
      Creates a result.
      Parameters:
      outcome - The outcome.
      status - The HTTP status, 0 for none.
      detail - The diagnostic, null for none.
      Returns:
      The result.
    • isRetryable

      public boolean isRetryable()
      Checks if the engine should retry this send later.
      Returns:
      true for DeliveryOutcome.SPOOLED.
    • 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.
    • outcome

      public DeliveryOutcome outcome()
      Returns the value of the outcome record component.
      Returns:
      the value of the outcome record component
    • status

      public int status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • detail

      public String detail()
      Returns the value of the detail record component.
      Returns:
      the value of the detail record component
    • retryAfterMillis

      public long retryAfterMillis()
      Returns the value of the retryAfterMillis record component.
      Returns:
      the value of the retryAfterMillis record component