flowStart

abstract suspend fun flowStart(name: String, flowEntryPoint: String? = null, metadata: Map<String, String> = emptyMap(), cleanupPolicy: CleanupPolicy = OnTimeout(duration = 7.days), samplingProbability: Float = 1.0f): Result<Long>

Begin a new flow.

Return

Wide event ID used for subsequent calls.

Parameters

name

Stable flow name (e.g., "subscription_purchase").

flowEntryPoint

Optional identifier of the flow entry point (e.g., "app_settings")

metadata

Optional metadata (e.g., "free_trial_eligible=true").

cleanupPolicy

Strategy for dealing with abandoned events, see CleanupPolicy for details.

samplingProbability

Probability in 0.0, 1.0 that this event will be recorded. E.g., 0.1 means ~10 % of events are kept and the rest are silently dropped. When an event is sampled out, SAMPLED_OUT_FLOW_ID is returned and all subsequent operations on that ID become no-ops.