Package io.github.centrifugal.centrifuge
Class SubscriptionOptions
java.lang.Object
io.github.centrifugal.centrifuge.SubscriptionOptions
Configuration for a
Subscription instance.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getData()getDelta()intintlonggetSince()getToken()booleanbooleanbooleanvoidsetData(byte[] data) voidvoidsetJoinLeave(boolean joinLeave) voidsetMaxResubscribeDelay(int maxResubscribeDelay) voidsetMinResubscribeDelay(int minResubscribeDelay) voidsetOffsetFlushInterval(long offsetFlushInterval) Set the interval in milliseconds between offset flushes to disk.voidsetOffsetStorageDir(String offsetStorageDir) Set a custom directory for storing offsets.voidsetOnOffsetUpdate(OffsetUpdateListener onOffsetUpdate) Set a listener that is called when the subscription offset is updated (on each publication and on initial subscribe).voidsetPositioned(boolean positioned) voidsetRecoverable(boolean recoverable) voidsetSince(StreamPosition streamPosition) voidvoidsetTokenGetter(SubscriptionTokenGetter tokenGetter)
-
Field Details
-
tokenGetter
-
-
Constructor Details
-
SubscriptionOptions
public SubscriptionOptions()
-
-
Method Details
-
getToken
-
setToken
-
getTokenGetter
-
setTokenGetter
-
getData
public byte[] getData() -
setData
public void setData(byte[] data) -
getMinResubscribeDelay
public int getMinResubscribeDelay() -
setMinResubscribeDelay
public void setMinResubscribeDelay(int minResubscribeDelay) -
getMaxResubscribeDelay
public int getMaxResubscribeDelay() -
setMaxResubscribeDelay
public void setMaxResubscribeDelay(int maxResubscribeDelay) -
isPositioned
public boolean isPositioned() -
setPositioned
public void setPositioned(boolean positioned) -
isRecoverable
public boolean isRecoverable() -
setRecoverable
public void setRecoverable(boolean recoverable) -
isJoinLeave
public boolean isJoinLeave() -
setJoinLeave
public void setJoinLeave(boolean joinLeave) -
getDelta
-
setDelta
-
setSince
-
getSince
-
setOnOffsetUpdate
Set a listener that is called when the subscription offset is updated (on each publication and on initial subscribe). Use this to persist the offset to disk for recovery across process restarts. -
getOnOffsetUpdate
-
setOffsetStorageDir
Set a custom directory for storing offsets. If not provided, SDK uses platform-specific default location with multi-level fallback (macOS: ~/Library/Application Support/centrifugo/offsets/, Linux: ~/.local/share/centrifugo/offsets/, Windows: %APPDATA%/centrifugo/offsets/).IMPORTANT: If you run multiple client processes on the same machine subscribing to the same channel, each process MUST use a different
offsetStorageDirto avoid overwriting each other's offsets.- Parameters:
offsetStorageDir- path to directory for offset files, must be unique per process when multiple processes subscribe to the same channel.
-
getOffsetStorageDir
-
setOffsetFlushInterval
public void setOffsetFlushInterval(long offsetFlushInterval) Set the interval in milliseconds between offset flushes to disk. The first offset is always persisted immediately; subsequent writes are throttled to this interval. Lower values reduce duplicate delivery on crash but increase disk I/O. Default: 30000 (30 seconds).- Parameters:
offsetFlushInterval- interval in milliseconds.
-
getOffsetFlushInterval
public long getOffsetFlushInterval()
-