static void ProcessRequests <TCommand, TRequest, TResponse>(ICommandMetaclass <TCommand, TRequest, TResponse> metaclass, ConcurrentQueue <CommandRequestOp <TCommand, TRequest> > requestOps) where TCommand : ICommandMetaclass { while (requestOps.Count > 0) { if (requestOps.TryDequeue(out var op)) { connection.SendCommandRequest(metaclass, op.EntityId, op.Request, null, commandParameterNoShortCircuit); } } }
static void ProcessResponses <TCommand, TRequest, TResponse>(ICommandMetaclass <TCommand, TRequest, TResponse> metaclass, ConcurrentQueue <CommandResponseOp <TCommand, TResponse> > responseOps) where TCommand : ICommandMetaclass { while (responseOps.Count > 0) { if (responseOps.TryDequeue(out var op)) { var id = new RequestId <IncomingCommandRequest <TCommand> >(op.RequestId.Id); connection.SendCommandResponse(metaclass, id, op.Response.Value); } } }
static void ProcessRequests <TCommand, TRequest, TResponse>(ICommandMetaclass <TCommand, TRequest, TResponse> metaclass, ConcurrentQueue <CommandRequestOp <TCommand, TRequest> > requestOps, ConcurrentDictionary <long, long> requestIds) where TCommand : ICommandMetaclass { while (requestOps.Count > 0) { if (requestOps.TryDequeue(out var op)) { var outgoingRequest = connection.SendCommandRequest(metaclass, op.EntityId, op.Request, null, commandParameterNoShortCircuit); requestIds[outgoingRequest.Id] = op.EntityId.Id; } } }