示例#1
0
        public async Task <Result> Sync(string queue, string vhost, QueueSyncAction syncAction, CancellationToken cancellationToken = default)
        {
            cancellationToken.RequestCanceled();

            QueueSyncRequest request = new QueueSyncRequest(syncAction);

            Debug.Assert(request != null);

            var errors = new List <Error>();

            if (string.IsNullOrWhiteSpace(vhost))
            {
                errors.Add(new ErrorImpl("The name of the virtual host is missing."));
            }

            if (string.IsNullOrWhiteSpace(queue))
            {
                errors.Add(new ErrorImpl("The name of the queue is missing."));
            }

            string url = $"api/queues/{vhost.ToSanitizedName()}/{queue}/actions";

            if (errors.Any())
            {
                return(new FaultedResult <QueueInfo>(new DebugInfoImpl(url, errors)));
            }

            return(await PostRequest(url, request, cancellationToken).ConfigureAwait(false));
        }
示例#2
0
 public QueueSyncRequest(QueueSyncAction action)
 {
     Action = action;
 }
示例#3
0
 public async Task <Result> Sync(string queue, string vhost, QueueSyncAction syncAction, CancellationToken cancellationToken = default) => throw new NotImplementedException();