/// <summary> /// Add the command request to the waiting list. /// </summary> /// <param name="command">The command to send</param> /// <returns></returns> protected CommandAsyncEvent EnqueueCommand(BaseCommand command) { var event2 = new CommandAsyncEvent(command); _requestsQueue.Enqueue(event2); return(event2); }
public async Task <ApiResponse> SendApiAsync(ApiCommand command, IChannel context) { var asyncEvent = new CommandAsyncEvent(command); CommandAsyncEvents.Enqueue(asyncEvent); await context.WriteAndFlushAsync(command); return(await asyncEvent.Task as ApiResponse); }
public async Task <CommandReply> SendCommandAsync(BaseCommand command, IChannel context) { var asyncEvent = new CommandAsyncEvent(command); CommandAsyncEvents.Enqueue(asyncEvent); await context.WriteAndFlushAsync(command); return(await asyncEvent.Task as CommandReply); }
internal async Task <Guid> SendBgApiAsync(BgApiCommand command, IChannel context) { var asyncEvent = new CommandAsyncEvent(command); var jobUuid = Guid.Empty; CommandAsyncEvents.Enqueue(asyncEvent); await context.WriteAndFlushAsync(command); var reply = await asyncEvent.Task as CommandReply; if (reply == null) { return(jobUuid); } if (reply.IsOk) { return(Guid.TryParse(reply[EslHeaders.JobUuid], out jobUuid) ? jobUuid : Guid.Empty); } return(jobUuid); }
/// <summary> /// Add the command request to the waiting list. /// </summary> /// <param name="command">The command to send</param> /// <returns></returns> protected CommandAsyncEvent EnqueueCommand(BaseCommand command) { var event2 = new CommandAsyncEvent(command); _requestsQueue.Enqueue(event2); return event2; }