Package com.tnsai.coordination.voting
Class ConsensusBuilder
java.lang.Object
com.tnsai.coordination.voting.ConsensusBuilder
Fluent builder that orchestrates a voting session among agents.
Example usage:
VotingResult result = ConsensusBuilder.create()
.topic("Which database to use?")
.options("PostgreSQL", "MySQL", "MongoDB")
.among(List.of(agent1, agent2, agent3))
.method(VotingMethod.MAJORITY)
.timeout(Duration.ofSeconds(30))
.quorum(2)
.vote();
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConsensusBuildercreate()listener(VotingListener listener) method(VotingMethod method) quorum(int quorum) supermajorityThreshold(double threshold) vote()Executes the vote synchronously, collecting votes from all agents in parallel.
-
Method Details
-
create
-
topic
-
options
-
options
-
among
-
method
-
timeout
-
quorum
-
supermajorityThreshold
-
listener
-
vote
Executes the vote synchronously, collecting votes from all agents in parallel.- Returns:
- The voting result
- Throws:
IllegalStateException- if topic, options, or voters are not set
-