/// <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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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;
 }