This project is read-only.

BusQ

BusQ makes it easier for developers to work with Azure Service Bus Queues. You'll no longer have to create Topic or Queue receivers to listen for messages. It's developed in C# with Reactive Extensions.

Listening to a Service Bus Queue

//Create the listener
var listener = new Listener();

//Configure the listener and start it
listener.From("<your-issuer-name>", "<your-secret-key>", "<namespace>")
	.Where(queueName: "MyQueue")
	.Subscribe<StatusChangedEvent>(x => { //do something here })
	.Subscribe<MessageReceivedEvent>(x => { //and here })
	.Subscribe<ReceptionErrorEvent>(x => { //and here })
	.Start();

Console.WriteLine("Listener running...");
Console.WriteLine("Preass any key to stop it");
Console.Read();

//Stop and Dispose it
listener.Stop();
listener.Dispose();

Listening to a Service Bus Topic

//Create the listener
using(var listener = new Listener())
{
	//Configure the listener and start it
	listener.From("<your-issuer-name>", "<your-secret-key>", "<namespace>")
		.Where(topicName: "MyTopic", subscriptionName: "MySub")
		.Subscribe<StatusChangedEvent>(x => { //do something here })
		.Subscribe<MessageReceivedEvent>(x => { //and here })
		.Subscribe<ReceptionErrorEvent>(x => { //and here })
		.Start();

	Console.WriteLine("Listener running...");
	Console.WriteLine("Preass any key to stop it");
	Console.Read();

	//Stop and Dispose it
	listener.Stop();
}

An Observable Listener

//Create the listener
var listener = new Listener();

//Configure the listener and start it
var listener = listener.From("<your-issuer-name>", "<your-secret-key>", "<namespace>")
				.Where(queueName: "MyQueue");

listener.AsObservable<MessageReceivedEvent>()
	.Where(x => x.Message.Label.Contains("something"))
	.Subscribe(x => { //do something here })

listener.Start();

Console.WriteLine("Listener running...");
Console.WriteLine("Preass any key to stop it");
Console.Read();

//Stop and Dispose it
listener.Stop();
listener.Dispose();

Last edited Mar 22, 2012 at 9:47 PM by gentilem, version 24