Esempio n. 1
0
        private async Task <Queue> CreateTestQueueInVhost(string queueName, Vhost vhost)
        {
            var queueInfo = new QueueInfo(queueName);
            await managementClient.CreateQueueAsync(queueInfo, vhost).ConfigureAwait(false);

            return(await managementClient.GetQueueAsync(queueName, vhost).ConfigureAwait(false));
        }
        /// <summary>
        ///     Create the given queue
        /// </summary>
        /// <param name="source"></param>
        /// <param name="queueInfo"></param>
        /// <param name="vhost"></param>
        /// <param name="cancellationToken"></param>
        public static Queue CreateQueue(
            [NotNull] this IManagementClient source,
            [NotNull] QueueInfo queueInfo,
            [NotNull] Vhost vhost,
            CancellationToken cancellationToken = default
            )
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            return(source.CreateQueueAsync(queueInfo, vhost, cancellationToken)
                   .GetAwaiter()
                   .GetResult());
        }
Esempio n. 3
0
 public async Task Should_be_able_to_create_a_queue()
 {
     (await managementClient.CreateQueueAsync(new QueueInfo(testQueue), Configuration.RabbitMqVirtualHost).ConfigureAwait(false))
     .Name.ShouldEqual(testQueue);
 }