Class Stream<T>
java.lang.Object
io.superdurable.dex.PersistenceDefinition
io.superdurable.dex.Stream<T>
- Type Parameters:
T- the message type
Defines a typed best-effort resumable message Stream owned by one Flow type.
Register the exact definition in one PersistenceSchema. All instances of that Flow
type share the approximate byte budget. Step writes are immediate and do not roll back when the
handler later fails.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Stream<T> Creates a typed Stream definition.longReturns the approximate shared byte budget.Returns the logical Stream name.voidAppends one message immediately from the current Step execution.
-
Method Details
-
define
Creates a typed Stream definition.- Type Parameters:
T- the message type- Parameters:
name- the nonblank logical name unique within its FlowvalueType- the concrete message class used for decodingstreamCapacityBytes- the positive approximate shared byte budget- Returns:
- an immutable Stream definition
-
write
Appends one message immediately from the current Step execution.This method sends a fire-and-forget frame to Dex. It may be called repeatedly for the same Stream. Each frame also acts as an implicit activity heartbeat. Storage failures do not fail the Step, but local validation, serialization, or transport failures may throw.
- Parameters:
context- the current Step Context; RPC and Flow timeout Contexts are rejectedvalue- the typed message to append- Throws:
IllegalStateException- if the Context belongs to an RPC or Flow timeout handlerio.grpc.StatusRuntimeException- if the Step invocation is canceled or transport failsValueMappingException- if the value cannot be encoded
-
getStreamName
-
getStreamCapacityBytes
public long getStreamCapacityBytes()Returns the approximate shared byte budget.- Returns:
- the positive budget in bytes
-