Giter VIP home page Giter VIP logo

orleansr's Introduction

OrleansR

A SignalR backplane implemented in Orleans

Motivation

When running SignalR on more than one web server (a common scenario in the cloud) you need a backplane to connect together each of the servers. This allows messages broadcast from a user connected to one server, to reach the users on the other servers.

There are already some backplane options in Azure:

  • SQL Server
  • Service Bus Topics/Subscriptions
  • Redis (you should probably use this)

I thought it would be interesting to implement a backplane in Orleans.

Project Structure

The projects required to implement a system:

  • OrleansR.GrainInterfaces The Oreans grain interfaces.
  • OrleansR.Grains The Orleans grain implementations.
  • OrleansR.MessageBus The IMessageBus implementation which plugs into SignalR, and connects to the Orleans Silos.

Sample/test projects included in the solution:

  • OrleansR.Cloud A sample project to deploy the solution to Azure.
  • OrleansR.UnitTests Unit tests for the grains.
  • OrleansR.Web A sample web application.
  • OrleansR.WorkerRoleSiloHost A sample Worker Role to host the Orleans Silo.

Usage

Configure Orleans in the usual way, by starting up a Silo, and connecting a web application to it as described here.

When configuring SignalR in the Startup class of your web application, register the OrleanMessageBus class like this:

using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Messaging;
using OrleansR.MessageBus;
using Owin;

namespace OrleansR.Web
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
 			// configure the OrleansR message bus
            var config = new ScaleoutConfiguration { MaxQueueLength = 10, QueueBehavior = QueuingBehavior.Always };
            var omb = new OrleansMessageBus(GlobalHost.DependencyResolver, config);
            GlobalHost.DependencyResolver.Register(typeof(IMessageBus), () => omb);

            // register SignalR as ususal
            app.MapSignalR();
        }
    }
}

License

MIT

orleansr's People

Contributors

richorama avatar

Watchers

James Cloos 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.