Пример #1
0
        public async Task TopicAndSubscriptionCreateAndSentBatch()
        {
            var topicName          = Guid.NewGuid().ToString("N");
            var subName            = Guid.NewGuid().ToString("N");
            var topicQueueName     = QueueName.FromTopicName(topicName);
            var queueName          = QueueName.FromTopicAndSubscriptionName(topicName, subName);
            var serviceBusOperator = new ServiceBusOperator(ConnectionString);


            await serviceBusOperator.CreateQueueAsync(topicQueueName);

            await serviceBusOperator.CreateQueueAsync(queueName);

            await serviceBusOperator.PushBatchAsync(new[] { new Event("chashm")
                                                            {
                                                                QueueName = topicQueueName.ToString()
                                                            },
                                                            new Event("chashm")
                                                            {
                                                                QueueName = topicQueueName.ToString()
                                                            } });

            await serviceBusOperator.DeleteQueueAsync(queueName);

            await serviceBusOperator.DeleteQueueAsync(topicQueueName);
        }
Пример #2
0
        public void TopicAndSubscriptionCreateAndSentBatch()
        {
            var topicName = Guid.NewGuid().ToString("N");
            var subName = Guid.NewGuid().ToString("N");
            var topicQueueName = QueueName.FromTopicName(topicName);
            var queueName = QueueName.FromTopicAndSubscriptionName(topicName, subName);
            var serviceBusOperator = new ServiceBusOperator(ConnectionString);


            serviceBusOperator.CreateQueueAsync(topicQueueName).Wait();
            serviceBusOperator.CreateQueueAsync(queueName).Wait();

            serviceBusOperator.PushBatchAsync(new[]{ new Event("chashm")
            {
                QueueName = topicQueueName.ToString()
            },
            new Event("chashm")
            {
                QueueName = topicQueueName.ToString()
            }
            }).Wait();

            serviceBusOperator.DeleteQueueAsync(queueName).Wait();
            serviceBusOperator.DeleteQueueAsync(topicQueueName).Wait();


        }