public void Add(MessageEnvelope envelope) { var id = GetId(envelope); ConsensusAggregate aggregate = GetConsensusAggregate(id); //add the signature to the aggregate aggregate.Add(envelope); }
public void Add(IncomingMessage message) { var id = GetId(message.Envelope); ConsensusAggregate aggregate = GetConsensusAggregate(id); //add the signature to the aggregate aggregate.Add(message); }
private ConsensusAggregate GetConsensusAggregate(string id) { lock (syncRoot) { if (!pendingAggregates.TryGetValue(id, out var consensusAggregate)) { consensusAggregate = new ConsensusAggregate(id, this); pendingAggregates[id] = consensusAggregate; } return(consensusAggregate); } }