Skip to content

Commit 3584bec

Browse files
committed
feat(sse): sync H-104 contract
1 parent ed9077c commit 3584bec

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package io.github.easy4j.hermes.transport;
2+
3+
/**
4+
* Classifies request behavior so transport recovery cannot accidentally replay side-effecting work.
5+
*
6+
* @since 1.0.0
7+
*/
8+
public enum RequestSemantics {
9+
/** A read may be retried only by HTTP retry policy; it is not an SSE observation reattach. */
10+
READ(true, false),
11+
/** Creating agent work must never be replayed merely because response observation failed. */
12+
AGENT_CREATE(false, false),
13+
/** Side-effecting control writes require an explicit verified idempotency contract before replay. */
14+
CONTROL_WRITE(false, false),
15+
/** Re-observing an already existing run may reconnect without creating new work. */
16+
OBSERVE(false, true);
17+
18+
private final boolean transportReplaySafe;
19+
private final boolean observationReattachAllowed;
20+
21+
RequestSemantics(boolean transportReplaySafe, boolean observationReattachAllowed) {
22+
this.transportReplaySafe = transportReplaySafe;
23+
this.observationReattachAllowed = observationReattachAllowed;
24+
}
25+
26+
public boolean isTransportReplaySafe() {
27+
return transportReplaySafe;
28+
}
29+
30+
public boolean isObservationReattachAllowed() {
31+
return observationReattachAllowed;
32+
}
33+
}

0 commit comments

Comments
 (0)