Git Product home page Git Product logo

signalr.nservicebus's Introduction

SignalR.NServiceBus

NServiceBus backplane for SignalR

To use this backplane in a SignalR host, add a reference to SignalR.NServiceBus, initialize an IBus and configure SignalR to use NServiceBus. In ASP.NET, this would look something like this:

In Startup.cs:

	using Microsoft.AspNet.SignalR;
	using Microsoft.AspNet.SignalR.Messaging;
	using NServiceBus;
	using Owin;

	namespace DemoWebApp
	{
		public class Startup
		{
			public IBus Bus;

			public void Configuration(IAppBuilder app)
			{
				// Any connection or hub wire up and configuration should go here
				app.MapSignalR();

				Bus = Configure
					.With()
					.DefaultBuilder()
					.UseTransport<Msmq>()
					.UseInMemoryTimeoutPersister()
					.UnicastBus()
					.LoadMessageHandlers()
					.CreateBus()
					.Start();

				var config = new ScaleoutConfiguration() { MaxQueueLength = 100 }; // Or whatever you want
				GlobalHost.DependencyResolver.UseNServiceBus(Bus, config);
			}
		}
	}

The website in the demo project is mapped to local IIS. In order to make this work, you must make sure that the App Pool user has permission to access the queues involved in this sample: all queues starting with signalr.nservicebus.backplaneservice and all queues starting with system.web:

  • signalr.nservicebus.backplaneservice

  • signalr.nservicebus.backplaneservice.retries

  • signalr.nservicebus.backplaneservice.timeouts

  • signalr.nservicebus.backplaneservice.timeoutdispatcher

  • system.web

  • system.web.retries

  • system.web.timeouts

  • system.web.timeoutdispatcher

Also, make sure that you have configured the endpoint of the backplane in the config of your SignalR host:

    <configuration>
      <configSections>
        <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
        <section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
      </configSections>
      <UnicastBusConfig>
        <MessageEndpointMappings>
          <!-- the endpoint on which the backplane is listening for commands -->
          <!-- SignalR will subscribe to new messages via that endpoint -->
          <add Messages="SignalR.NServiceBus" Endpoint="signalr.nservicebus.backplane" />
        </MessageEndpointMappings>
      </UnicastBusConfig>
    
      <MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
    </configuration>

To run the backplane itself, just start the SignalR.NServiceBus.BackplaneService project (it uses the NServiceBus generic host).

Author

Roy Cornelissen

For more info, see my blogpost

signalr.nservicebus's People

Contributors

johnsimons avatar roycornelissen avatar

Watchers

 avatar  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.