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 Summary
ConstructorsConstructorDescriptionTransportResult(DeliveryOutcome outcome, int status, String detail, long retryAfterMillis) Creates an instance of aTransportResultrecord class.Method Summary
Modifier and TypeMethodDescriptiondetail()Returns the value of thedetailrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanChecks if the engine should retry this send later.static TransportResultof(DeliveryOutcome outcome, int status, String detail) Creates a result.outcome()Returns the value of theoutcomerecord component.longReturns the value of theretryAfterMillisrecord component.intstatus()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.
Constructor Details
TransportResult
Creates an instance of aTransportResultrecord class.- Parameters:
outcome- the value for theoutcomerecord componentstatus- the value for thestatusrecord componentdetail- the value for thedetailrecord componentretryAfterMillis- the value for theretryAfterMillisrecord component
Method Details
of
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
hashCode
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.outcome
status
detail
retryAfterMillis
public long retryAfterMillis()Returns the value of theretryAfterMillisrecord component.- Returns:
- the value of the
retryAfterMillisrecord component