Giter Site home page Giter Site logo

masstransit-azureservicebus's Introduction

MassTransit AzureServiceBus Transport

A transport over AppFabric Service Bus in Azure. Currently capable of pub-sub and sending to endpoints.

First, get your Azure account

https://www.windowsazure.com/en-us/develop/net/how-to-guides/service-bus-topics/#what-is. It's free the first three months.

Second, configure MassTransit with the transport

using (ServiceBusFactory.New(sbc =>
	{
		sbc.ReceiveFrom(
			"azure-sb://owner:bjOAWQJalkmd9LKas0lsdklkdw4mAHwKZUJ1jKwTLdc=@myNamespace/my-application"
			);
		sbc.UseAzureServiceBus();
		sbc.UseAzureServiceBusRouting();
	}))
{
	// use the bus here...
}

or alternatively:

using (ServiceBusFactory.New(sbc =>
{
	sbc.ReceiveFromComponents("owner", "bjOAWQJalkmd9LKas0lsdklkdw4mAHwKZUJ1jKwTLdc=", 
							  "myNamespace", "my-application");
	sbc.UseAzureServiceBus();
	sbc.UseAzureServiceBusRouting();
}))
{
	// use the bus here...
}

Aims:

  • GetEndpoint(...).Send<T>(this ..., T msg). [Done]
  • Sub-Pub over message types [Done]
  • Binding to specific topic on publish of message if subscriber exists in bus. [Done]
  • Purging of queues by deleting them and re-creating them. [Done]
  • Smooth asynchronous transient fault handling [Done] (AsyncRetry.fs)
  • Maximum performance. A middle ground of low latency (50 ms) and high throughput (batching, concurrent receives). [Done]
  • Polymorphic Publish-Subscribe [Ongoing]

Compiling the code

In order to compile the tests, you have to have a class called AccountDetails similar to this:

using System;
using MassTransit.Transports.AzureServiceBus.Configuration;

namespace MassTransit.Transports.AzureServiceBus.Tests.Framework
{
	// WARNING: note: DO NOT RENAME this file, or you'll commit the account details

	/// <summary>
	/// 	Actual AccountDetails
	/// </summary>
	public class AccountDetails
		: PreSharedKeyCredentials
	{
		static readonly PreSharedKeyCredentials _instance = new Credentials(IssuerName, Key, Namespace, Application);

		private static string ENV(string name)
		{
			return Environment.GetEnvironmentVariable(name);
		}

		public static string Key
		{
			get { return ENV("AccountDetailsKey") ?? "adfmald0f9j23lkmsd+Ww4mAHwKZUJ1jKwTLdc="; }
		}

		public static string IssuerName
		{
			get { return ENV("AccountDetailsIssuerName") ?? "owner"; }
		}

		public static string Namespace
		{
			get { return ENV("AccountDetailsNamespace") ?? "mt"; }
		}

		public static string Application
		{
			get { return ENV("Application") ?? "my-application"; }
		}

		string PreSharedKeyCredentials.IssuerName
		{
			get { return _instance.IssuerName; }
		}

		string PreSharedKeyCredentials.Key
		{
			get { return _instance.Key; }
		}

		string PreSharedKeyCredentials.Namespace
		{
			get { return _instance.Namespace; }
		}

		string PreSharedKeyCredentials.Application
		{
			get { return Application; }
		}

		public Uri BuildUri(string application = null)
		{
			return _instance.BuildUri(application);
		}

		public PreSharedKeyCredentials WithApplication(string application)
		{
			return _instance.WithApplication(application);
		}
	}
}

Place this file in src\MassTransit.Transports.AzureServiceBus.Tests\Framework\AccountDetails.cs.

Contributing

Download the code. Hack on it in a feature branch like described with this flow. Send a pull request to /develop from your feature branch.

masstransit-azureservicebus's People

Contributors

haf avatar bytenik avatar ptomasroos avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.