Class ChoreographySpec
java.lang.Object
com.tnsai.coordination.choreography.ChoreographySpec
Declarative specification of agent interactions for choreography-based coordination.
Unlike orchestration (centralized control), choreography defines decentralized rules
where each agent reacts to events autonomously.
Example usage:
ChoreographySpec spec = ChoreographySpec.builder("order-processing")
.initialEvent("order.placed")
.interaction("validate", "system", "validator", "order.placed", "order.validated", "Validate order")
.interaction("charge", "validator", "billing", "order.validated", "payment.done", "Charge payment")
.interaction("ship", "billing", "shipper", "payment.done", "order.shipped", "Ship order")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordA single interaction rule in the choreography. -
Method Summary
Modifier and TypeMethodDescriptionagents()Returns all agent IDs participating in this choreography.Returns all distinct event names in this spec.static ChoreographySpec.BuilderReturns interactions targeting a specific agent.name()triggeredBy(String event) Returns interactions triggered by a specific event.
-
Method Details
-
name
-
interactions
-
initialEvents
-
agents
Returns all agent IDs participating in this choreography. -
triggeredBy
Returns interactions triggered by a specific event. -
forAgent
Returns interactions targeting a specific agent. -
allEvents
Returns all distinct event names in this spec. -
builder
-