예제 #1
0
        /// <summary>
        /// Sends a key/value operation to it's mapped server asynchronously.
        /// </summary>
        /// <typeparam name="T">The <see cref="Type" /> T of the body.</typeparam>
        /// <param name="operation">The <see cref="IOperation{T}" /> to send.</param>
        /// <returns>
        /// A <see cref="Task" /> representing the asynchronous operation.
        /// </returns>
        public async Task SendAsync <T>(IOperation <T> operation)
        {
            if (_isDown)
            {
                var msg = ExceptionUtil.GetNodeUnavailableMsg(EndPoint,
                                                              _clientConfiguration.NodeAvailableCheckInterval);

                operation.Completed(new SocketAsyncState
                {
                    Exception = new NodeUnavailableException(msg),
                    Opaque    = operation.Opaque,
                    Status    = ResponseStatus.NodeUnavailable
                });
                return;
            }
            await _ioStrategy.ExecuteAsync(operation);
        }
예제 #2
0
 public Task <IOperationResult <T> > SendAsync <T>(IOperation <T> operation)
 {
     return(_ioStrategy.ExecuteAsync(operation));
 }