Class ManagedSagaContext
java.lang.Object
org.j7m.middleware.application.distributed.ManagedSagaContext
Revocable current saga callback capability, installed only by its actual trusted host policy.
Staged protected CAS effects commit atomically with a forward step's durable successful result;
they are not immediate writes and cannot protect arbitrary external effects. A captured context
never authorizes a different callback or work after the original USER scope has sealed.
-
Method Summary
Modifier and TypeMethodDescriptionlongfence()Returns the native run ownership fence.Returns the exact external protocol key retained across safe replay and takeover.longReturns the immutable source ownership epoch pinned when this callback was admitted.booleanrevoked()Observes local revocation without acquiring or renewing any authority.sagaId()Returns the stable logical saga identity for this callback.voidstageEffect(String key, long expectedVersion, String value) Stages a bounded native execution-map compare-and-set for successful forward completion.step()Returns the persisted step identity.toString()Omits business identities and staged values from diagnostics.
-
Method Details
-
sagaId
Returns the stable logical saga identity for this callback.- Returns:
- original run identity
- Throws:
org.j7m.middleware.api.MiddlewareException- outside this live callback
-
step
Returns the persisted step identity.- Returns:
- stable step name
- Throws:
org.j7m.middleware.api.MiddlewareException- outside this live callback
-
idempotencyKey
Returns the exact external protocol key retained across safe replay and takeover. The application must actually send this key to an external service that honors idempotency.- Returns:
- persisted key; compensation uses its original step key with a fixed compensation suffix
- Throws:
org.j7m.middleware.api.MiddlewareException- outside this live callback
-
fence
public long fence()Returns the native run ownership fence. It is not an arbitrary database lock token.- Returns:
- current native fence
- Throws:
org.j7m.middleware.api.MiddlewareException- outside this live callback
-
partitionEpoch
public long partitionEpoch()Returns the immutable source ownership epoch pinned when this callback was admitted. It never follows a migrated partition; the final native mutation verifies the same epoch.- Returns:
- captured positive partition epoch
- Throws:
org.j7m.middleware.api.MiddlewareException- outside this live callback
-
revoked
public boolean revoked()Observes local revocation without acquiring or renewing any authority.- Returns:
- whether this context has been revoked or its conservative local lease has expired
-
stageEffect
Stages a bounded native execution-map compare-and-set for successful forward completion. The host namespaces the key. At most16 distinct keys fit one callback; duplicate keys fail before a native mutation. Compensation cannot stage these effects because its native result protocol has no atomic protected-map effect boundary.- Parameters:
key- application key, 1..128 identifier charactersexpectedVersion- exact current native value version, zero for absencevalue- string value, at most4096 UTF16 code units and no NUL- Throws:
org.j7m.middleware.api.MiddlewareException- after revocation, cancellation or the original deadlineIllegalArgumentException- for compensation, duplicate key or invalid/bounded input
-
toString
-