Settings for the Service Bus scale-out message bus implementation.
Inheritance: Microsoft.AspNet.SignalR.Messaging.ScaleoutConfiguration
        /// <summary>
        /// Use Windows Azure Service Bus as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The Service Bus scale-out configuration options.</param>
        /// <returns>The dependency resolver</returns>
        /// <remarks>Note: Only Windows Azure Service Bus is supported. Service Bus for Windows Server (on-premise) is not supported.</remarks>
        public static IDependencyResolver UseServiceBus(this IDependencyResolver resolver, ServiceBusScaleoutConfiguration configuration)
        {
            var bus = new ServiceBusMessageBus(resolver, configuration);
            resolver.Register(typeof(IMessageBus), () => bus);

            return resolver;
        }
    public void Configuration(IAppBuilder app)
    {
        var connectionString = "Endpoint=sb://testsignalr.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=hHV59MthBwZIkEr4ZbAUIwlA1rWILFiMn7d82+EhEzI=";
        
        /* Example of connection string:
               "Endpoint=sb://someurl.servicebus.windows.net/;"
               + "SharedSecretIssuer=owner;"
               + "SharedSecretValue=I9gqKTXQxe2mdoMZ+5WPD6XQEn4Y3y+0/k9lFeMnt2o=";        
        */

        var config = new ServiceBusScaleoutConfiguration(connectionString, "Broadcaster")
                        {
                            TimeToLive = TimeSpan.FromSeconds(5),
                        };
        GlobalHost.DependencyResolver.UseServiceBus(config);
        app.MapSignalR();
    }
        /// <summary>
        /// Use Windows Azure Service Bus as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="connectionString">The Service Bus connection string to use.</param>
        /// <param name="topicPrefix">The topic prefix to use. Typically represents the app name. This must be consistent between all nodes in the web farm.</param>
        /// <returns>The dependency resolver</returns>
        /// <remarks>Note: Only Windows Azure Service Bus is supported. Service Bus for Windows Server (on-premise) is not supported.</remarks>
        public static IDependencyResolver UseServiceBus(this IDependencyResolver resolver, string connectionString, string topicPrefix)
        {
            var config = new ServiceBusScaleoutConfiguration(connectionString, topicPrefix);

            return UseServiceBus(resolver, config);
        }
Beispiel #4
0
        private static void SetupSignalR(IJabbrConfiguration jabbrConfig, IKernel kernel, IAppBuilder app)
        {
            var resolver = new NinjectSignalRDependencyResolver(kernel);
            var connectionManager = resolver.Resolve<IConnectionManager>();
            var heartbeat = resolver.Resolve<ITransportHeartbeat>();
            var hubPipeline = resolver.Resolve<IHubPipeline>();
            var configuration = resolver.Resolve<IConfigurationManager>();

            // Enable service bus scale out
            if (!String.IsNullOrEmpty(jabbrConfig.ServiceBusConnectionString) &&
                !String.IsNullOrEmpty(jabbrConfig.ServiceBusTopicPrefix))
            {
                var sbConfig = new ServiceBusScaleoutConfiguration(jabbrConfig.ServiceBusConnectionString,
                                                                   jabbrConfig.ServiceBusTopicPrefix)
                {
                    TopicCount = 5
                };

                resolver.UseServiceBus(sbConfig);
            }

            if (jabbrConfig.ScaleOutSqlServer)
            {
                resolver.UseSqlServer(ConfigurationManager.ConnectionStrings["Jabbr"].ConnectionString);
            }

            kernel.Bind<IConnectionManager>()
                  .ToConstant(connectionManager);

            // We need to extend this since the inital connect might take a while
            configuration.TransportConnectTimeout = TimeSpan.FromSeconds(30);

            var config = new HubConfiguration
            {
                Resolver = resolver
            };

            hubPipeline.AddModule(kernel.Get<LoggingHubPipelineModule>());

            app.MapSignalR(config);

            var monitor = new PresenceMonitor(kernel, connectionManager, heartbeat);
            monitor.Start();
        }
Beispiel #5
0
        /// <summary>
        /// Use Windows Azure Service Bus as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="configuration">The Service Bus scale-out configuration options.</param>
        /// <returns>The dependency resolver</returns>
        /// <remarks>Note: Only Windows Azure Service Bus is supported. Service Bus for Windows Server (on-premise) is not supported.</remarks>
        public static IDependencyResolver UseServiceBus(this IDependencyResolver resolver, ServiceBusScaleoutConfiguration configuration)
        {
            var bus = new ServiceBusMessageBus(resolver, configuration);

            resolver.Register(typeof(IMessageBus), () => bus);

            return(resolver);
        }
Beispiel #6
0
        /// <summary>
        /// Use Windows Azure Service Bus as the messaging backplane for scaling out of ASP.NET SignalR applications in a web farm.
        /// </summary>
        /// <param name="resolver">The dependency resolver.</param>
        /// <param name="connectionString">The Service Bus connection string to use.</param>
        /// <param name="topicPrefix">The topic prefix to use. Typically represents the app name. This must be consistent between all nodes in the web farm.</param>
        /// <returns>The dependency resolver</returns>
        /// <remarks>Note: Only Windows Azure Service Bus is supported. Service Bus for Windows Server (on-premise) is not supported.</remarks>
        public static IDependencyResolver UseServiceBus(this IDependencyResolver resolver, string connectionString, string topicPrefix)
        {
            var config = new ServiceBusScaleoutConfiguration(connectionString, topicPrefix);

            return(UseServiceBus(resolver, config));
        }