public async Task Recieve(CalculationRequest request) { var value = this.previous + request.Value; this.previous = value; await this.apiAgent.Send(new CalculationRequest(request.CorrelationId, value)); }
public async Task Receive(CalculationRequest calculationRequest) { var calculator = this.dictionary.GetOrAdd(calculationRequest.CorrelationId, _ => this.calculatorFactory()); this.log.Info($"Calculating next value for {calculationRequest.Value}"); await calculator.Recieve(calculationRequest); }