Last active
May 23, 2016 23:55
-
-
Save jtaubensee/9e945cb9ed9f218bee54b01b4be3683a to your computer and use it in GitHub Desktop.
Getting Started With Queues C# - Receiving Messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.ServiceBus.Messaging; | |
namespace GettingStartedWithQueues | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var connectionString = ""; | |
var queueName = "samplequeue"; | |
var client = QueueClient.CreateFromConnectionString(connectionString, queueName); | |
client.Send(new BrokeredMessage("Test Message")); | |
client.OnMessage(message => | |
{ | |
Console.WriteLine(String.Format("Message body: {0}", message.GetBody<String>())); | |
Console.WriteLine(String.Format("Message id: {0}", message.MessageId)); | |
}); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment