Package markets.alpaca.client.sse
Class AlpacaSseReconnectPolicy
java.lang.Object
markets.alpaca.client.sse.AlpacaSseReconnectPolicy
Retry and backoff settings for Server-Sent Events connections.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRetry forever after an established stream disconnects. -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsAttempt(boolean established, int attempt) builder()static AlpacaSseReconnectPolicyReturns the resilient Trading default: two initial retries and unlimited live reconnects.delayForAttempt(int attempt) static AlpacaSseReconnectPolicydisabled()Returns a policy that never reconnects.intintReturns the first client backoff and the minimum accepted server-directed reconnect delay.doubleReturns the maximum reconnect delay.Returns the maximum elapsed time for one reconnect cycle, ornullwhen unbounded.
-
Field Details
-
UNLIMITED_ATTEMPTS
public static final int UNLIMITED_ATTEMPTSRetry forever after an established stream disconnects.- See Also:
-
-
Method Details
-
defaultPolicy
Returns the resilient Trading default: two initial retries and unlimited live reconnects. -
disabled
Returns a policy that never reconnects. -
builder
-
toBuilder
-
initialAttempts
public int initialAttempts() -
establishedAttempts
public int establishedAttempts() -
initialBackoff
Returns the first client backoff and the minimum accepted server-directed reconnect delay.SSE
retry:and HTTPRetry-Aftervalues below this duration are raised to this value to prevent tight reconnect loops. -
maxBackoff
Returns the maximum reconnect delay.The cap applies to client exponential backoff, server-provided SSE
retry:values, and HTTPRetry-Aftervalues. -
maxElapsedTime
Returns the maximum elapsed time for one reconnect cycle, ornullwhen unbounded.The initial cycle spans connection attempts and backoff until the first accepted response. An established cycle starts after a transient disconnect and resets after an event is delivered. It remains active after reconnect headers during comments or silence. The budget includes connection time, lifecycle callback execution, client backoff,
retry:, andRetry-Afterdelays.This is separate from
AlpacaSseOptions.maxDuration(), which limits the lifetime of the entire subscription. -
jitterRatio
public double jitterRatio() -
allowsAttempt
public boolean allowsAttempt(boolean established, int attempt) -
delayForAttempt
-