public NetMQScaleoutMessageBus(IDependencyResolver resolver, NetMQScaleoutConfiguration configuration)
            : base(resolver, configuration)
        {
            _configuration = configuration;
            _context = NetMQContext.Create();

            var traceManager = resolver.Resolve<ITraceManager>();
            _trace = traceManager["SignalR." + typeof(NetMQScaleoutMessageBus).Name];

            SetupPublisher();

            ThreadPool.QueueUserWorkItem(Subscribe);
        }
Ejemplo n.º 2
0
        public NetMQScaleoutMessageBus(IDependencyResolver resolver, NetMQScaleoutConfiguration configuration)
            : base(resolver, configuration)
        {
            _configuration = configuration;
            _context       = NetMQContext.Create();

            var traceManager = resolver.Resolve <ITraceManager>();

            _trace = traceManager["SignalR." + typeof(NetMQScaleoutMessageBus).Name];

            SetupPublisher();

            ThreadPool.QueueUserWorkItem(Subscribe);
        }
        public SampleSignalRServer(int httpPort, int netMQPort, IEnumerable<int> subscriberPorts)
        {
            string serverUrl = string.Format("http://localhost:{0}", httpPort);
            string netMQAddress = string.Format("tcp://127.0.0.1:{0}", netMQPort);
            var subscriberAddresses = subscriberPorts
                .Select(p => string.Format("tcp://127.0.0.1:{0}", p))
                .ToArray();
            var config = new NetMQScaleoutConfiguration(netMQAddress, subscriberAddresses);

            _httpServer = WebApp.Start(serverUrl, app =>
            {
                var resolver = new DefaultDependencyResolver();
                resolver.UseNetMQServiceBus(config);
                var assemblyLocator = new AssemblyLocator();
                resolver.Register(typeof(IAssemblyLocator), () => assemblyLocator);
                var hubConfiguration = new HubConfiguration
                {
                    Resolver = resolver,
                };
                app.MapSignalR(hubConfiguration);
            });
        }
 public static IDependencyResolver UseNetMQServiceBus(this IDependencyResolver resolver, NetMQScaleoutConfiguration configuration)
 {
     var bus = new NetMQScaleoutMessageBus(resolver, configuration);
     resolver.Register(typeof(IMessageBus), () => bus);
     return resolver;
 }