Top Description Fields Constructors Methods
io.rsocket.core

public Class Resume

extends Object
Class Inheritance
Imports
io.netty.buffer.ByteBuf, io.rsocket.frame.ResumeFrameCodec, io.rsocket.resume.InMemoryResumableFramesStore, .ResumableFramesStore, java.time.Duration, java.util.Objects, java.util.function.Function, .Supplier, org.slf4j.Logger, .LoggerFactory, reactor.util.retry.Retry

Simple holder of configuration settings for the RSocket Resume capability. This can be used to configure an RSocketConnector or an RSocketServer except for retry(Retry) and token(Supplier) which apply only to the client side.

Field Summary

Modifier and TypeField and Description
private boolean
private static final Logger
private Retry
private Duration
private Function<? super ByteBuf, ? extends ResumableFramesStore>
private Duration
private Supplier<ByteBuf>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Resume

Returns:

the same instance for method chaining
cleanupStoreOnKeepAlive
()

When this property is enabled, hints from KEEPALIVE frames about how much data has been received by the other side, is used to proactively clean frames from the store.

pack-priv Retry
pack-priv Duration
pack-priv Function<? super ByteBuf, ? extends ResumableFramesStore>
pack-priv Duration
pack-priv Supplier<ByteBuf>
pack-priv boolean
public Resume

Returns:

the same instance for method chaining
retry
(Retry
the Retry spec to use when attempting to reconnect
retry
)

Configure the logic for reconnecting.

public Resume

Returns:

the same instance for method chaining
sessionDuration
(Duration
the max duration for a session
sessionDuration
)

The maximum time for a client to keep trying to reconnect.

public Resume

Returns:

the same instance for method chaining
storeFactory
(Function<? super ByteBuf, ? extends ResumableFramesStore>
the factory to use to create the store
storeFactory
)

Configure a factory to create the storage for buffering (or persisting) a window of frames that may need to be sent again to resume after a dropped connection.

public Resume

Returns:

the same instance for method chaining
streamTimeout
(Duration
the timeout value for resuming a session stream
streamTimeout
)

A timeout value to apply to the resumed session stream obtained from the store after a reconnect.

public Resume

Returns:

the same instance for method chaining
token
(Supplier<ByteBuf>
a custom generator for a resume identification token
supplier
)

Customize the generation of the resume identification token used to resume.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cleanupStoreOnKeepAliveback to summary
private boolean cleanupStoreOnKeepAlive
loggerback to summary
private static final Logger logger
retryback to summary
private Retry retry
sessionDurationback to summary
private Duration sessionDuration
storeFactoryback to summary
private Function<? super ByteBuf, ? extends ResumableFramesStore> storeFactory
streamTimeoutback to summary
private Duration streamTimeout
tokenSupplierback to summary
private Supplier<ByteBuf> tokenSupplier

Constructor Detail

Resumeback to summary
public Resume()

Method Detail

cleanupStoreOnKeepAliveback to summary
public Resume cleanupStoreOnKeepAlive()

When this property is enabled, hints from KEEPALIVE frames about how much data has been received by the other side, is used to proactively clean frames from the store.

By default this is set to false in which case information from KEEPALIVE is ignored and old frames from the store are removed only when the store runs out of space.

Returns:Resume

the same instance for method chaining

getRetryback to summary
pack-priv Retry getRetry()
getSessionDurationback to summary
pack-priv Duration getSessionDuration()
getStoreFactoryback to summary
pack-priv Function<? super ByteBuf, ? extends ResumableFramesStore> getStoreFactory(String tag)
getStreamTimeoutback to summary
pack-priv Duration getStreamTimeout()
getTokenSupplierback to summary
pack-priv Supplier<ByteBuf> getTokenSupplier()
isCleanupStoreOnKeepAliveback to summary
pack-priv boolean isCleanupStoreOnKeepAlive()
retryback to summary
public Resume retry(Retry retry)

Configure the logic for reconnecting. This setting is for use with RSocketConnector#resume(Resume) on the client side only.

By default this is set to:

Retry.backoff(Long.MAX_VALUE, Duration.ofSeconds(1))
    .maxBackoff(Duration.ofSeconds(16))
    .jitter(1.0)
Parameters
retry:Retry

the Retry spec to use when attempting to reconnect

Returns:Resume

the same instance for method chaining

sessionDurationback to summary
public Resume sessionDuration(Duration sessionDuration)

The maximum time for a client to keep trying to reconnect. During this time client and server continue to store unsent frames to keep the session warm and ready to resume.

By default this is set to 2 minutes.

Parameters
sessionDuration:Duration

the max duration for a session

Returns:Resume

the same instance for method chaining

storeFactoryback to summary
public Resume storeFactory(Function<? super ByteBuf, ? extends ResumableFramesStore> storeFactory)

Configure a factory to create the storage for buffering (or persisting) a window of frames that may need to be sent again to resume after a dropped connection.

By default InMemoryResumableFramesStore is used with its cache size set to 100,000 bytes. When the cache fills up, the oldest frames are gradually removed to create space for new ones.

Parameters
storeFactory:Function<? super ByteBuf, ? extends ResumableFramesStore>

the factory to use to create the store

Returns:Resume

the same instance for method chaining

streamTimeoutback to summary
public Resume streamTimeout(Duration streamTimeout)

A timeout value to apply to the resumed session stream obtained from the store after a reconnect. The resume stream must not take longer than the specified time to emit each frame.

By default this is set to 10 seconds.

Parameters
streamTimeout:Duration

the timeout value for resuming a session stream

Returns:Resume

the same instance for method chaining

tokenback to summary
public Resume token(Supplier<ByteBuf> supplier)

Customize the generation of the resume identification token used to resume. This setting is for use with RSocketConnector#resume(Resume) on the client side only.

By default this is ResumeFrameFlyweight::generateResumeToken.

Parameters
supplier:Supplier<ByteBuf>

a custom generator for a resume identification token

Returns:Resume

the same instance for method chaining