static void Main() { helloServiceBus = new ServiceBusTopic(ServiceBusConnectionString, QueueName, SubscriptionName); helloServiceBus.ReceiveMessage(printMessage, printMessageException); Console.ReadKey(); helloServiceBus.CloseConnectionAsync().GetAwaiter(); }
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(); }
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(); }
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)); }