コード例 #1
0
        static void Main()
        {
            helloServiceBus = new ServiceBusTopic(ServiceBusConnectionString, QueueName, SubscriptionName);
            helloServiceBus.ReceiveMessage(printMessage, printMessageException);

            Console.ReadKey();

            helloServiceBus.CloseConnectionAsync().GetAwaiter();
        }
コード例 #2
0
        public async Task SendTestAsync()
        {
            serviceBus = new ServiceBusQueue(ServiceBusConnectionString, QueueName);

            for (int i = 1; i <= 10; i++)
            {
                var message = $"Message {i}";
                await serviceBus.SendMessage(message);
            }

            await serviceBus.CloseConnectionAsync();
        }
コード例 #3
0
        public async Task SendTestAsync()
        {
            serviceBusQueue = new ServiceBusTopic(ServiceBusConnectionString, QueueName, SubscriptionName);

            for (int i = 1; i <= 10; i++)
            {
                var message = $"Topic Message {i}";
                await serviceBusQueue.SendMessage(message);
            }

            await serviceBusQueue.CloseConnectionAsync();
        }
コード例 #4
0
        public void ReceiveTestAsync()
        {
            connectionOpened = true;

            serviceBus = new ServiceBusQueue(ServiceBusConnectionString, QueueName);
            serviceBus.ReceiveMessage(printMessage);

            while (connectionOpened)
            {
            }

            serviceBus.CloseConnectionAsync().GetAwaiter();

            Assert.True(sequenceNumber > 0);
            Assert.True(!string.IsNullOrEmpty(messageBody));
        }