예제 #1
0
        public async Task <Queue> CreateQueueAsync(QueueInfo queueInfo, Vhost vhost,
                                                   CancellationToken cancellationToken = default(CancellationToken))
        {
            Ensure.ArgumentNotNull(queueInfo, nameof(queueInfo));
            Ensure.ArgumentNotNull(vhost, nameof(vhost));

            await PutAsync($"queues/{SanitiseVhostName(vhost.Name)}/{SanitiseName(queueInfo.GetName())}", queueInfo,
                           cancellationToken).ConfigureAwait(false);

            return(await GetQueueAsync(queueInfo.GetName(), vhost, cancellationToken : cancellationToken)
                   .ConfigureAwait(false));
        }
예제 #2
0
        public Queue CreateQueue(QueueInfo queueInfo, Vhost vhost)
        {
            if (queueInfo == null)
            {
                throw new ArgumentNullException("queueInfo");
            }
            if (vhost == null)
            {
                throw new ArgumentNullException("vhost");
            }

            Put(string.Format("queues/{0}/{1}", SanitiseVhostName(vhost.Name), queueInfo.GetName()), queueInfo);

            return(GetQueue(queueInfo.GetName(), vhost));
        }