Skip to content

Instantly share code, notes, and snippets.

@jtaubensee
Last active May 23, 2016 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtaubensee/9e945cb9ed9f218bee54b01b4be3683a to your computer and use it in GitHub Desktop.
Save jtaubensee/9e945cb9ed9f218bee54b01b4be3683a to your computer and use it in GitHub Desktop.
Getting Started With Queues C# - Receiving Messages
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