public Connection(IMessageBus newMessageBus,
                          JsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList<string> signals,
                          IList<string> groups,
                          ILoggerFactory loggerFactory,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData,
                          IMemoryPool pool)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            _bus = newMessageBus;
            _serializer = jsonSerializer;
            _baseSignal = baseSignal;
            _connectionId = connectionId;
            _signals = new List<string>(signals.Concat(groups));
            _groups = new DiffSet<string>(groups);
            _logger = loggerFactory.CreateLogger<Connection>();
            _ackHandler = ackHandler;
            _counters = performanceCounterManager;
            _protectedData = protectedData;
            _excludeMessage = m => ExcludeMessage(m);
            _pool = pool;
        }
Exemple #2
1
        public Connection(IMessageBus newMessageBus,
                          IJsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList<string> signals,
                          IList<string> groups,
                          ITraceManager traceManager,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData)
        {
            if (traceManager == null)
            {
                throw new ArgumentNullException("traceManager");
            }

            _bus = newMessageBus;
            _serializer = jsonSerializer;
            _baseSignal = baseSignal;
            _connectionId = connectionId;
            _signals = new List<string>(signals.Concat(groups));
            _groups = new DiffSet<string>(groups);
            _traceSource = traceManager["SignalR.Connection"];
            _ackHandler = ackHandler;
            _counters = performanceCounterManager;
            _protectedData = protectedData;
        }
Exemple #3
0
 public ServiceMessageBus(IDependencyResolver resolver) : base(resolver)
 {
     // TODO: find a more decent way instead of DI, it can be easily overriden
     _serviceConnectionManager = resolver.Resolve <IServiceConnectionManager>() ?? throw new ArgumentNullException(nameof(IServiceConnectionManager));
     _parser     = resolver.Resolve <IMessageParser>() ?? throw new ArgumentNullException(nameof(IMessageParser));
     _ackHandler = resolver.Resolve <IAckHandler>() ?? throw new ArgumentNullException(nameof(IAckHandler));
 }
Exemple #4
0
        public Connection(IMessageBus newMessageBus,
                          IJsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IEnumerable<string> signals,
                          IEnumerable<string> groups,
                          ITraceManager traceManager,
                          IAckHandler ackHandler,
                          IPerformanceCounterWriter performanceCounterWriter)
        {
            _bus = newMessageBus;
            _serializer = jsonSerializer;
            _baseSignal = baseSignal;
            _connectionId = connectionId;
            _signals = new HashSet<string>(signals);
            _groups = new SafeSet<string>(groups);
            _traceSource = new Lazy<TraceSource>(() => traceManager["SignalR.Connection"]);
            _ackHandler = ackHandler;

            var counters = performanceCounterWriter;
            _msgsRecTotalCounter = counters.GetCounter(PerformanceCounters.ConnectionMessagesReceivedTotal);
            _msgsRecPerSecCounter = counters.GetCounter(PerformanceCounters.ConnectionMessagesReceivedPerSec);
            _msgsSentTotalCounter = counters.GetCounter(PerformanceCounters.ConnectionMessagesSentTotal);
            _msgsSentPerSecCounter = counters.GetCounter(PerformanceCounters.ConnectionMessagesSentPerSec);
        }
        public Connection(IMessageBus newMessageBus,
                          JsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList <string> signals,
                          IList <string> groups,
                          ILoggerFactory loggerFactory,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData,
                          IMemoryPool pool)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException("loggerFactory");
            }

            _bus            = newMessageBus;
            _serializer     = jsonSerializer;
            _baseSignal     = baseSignal;
            _connectionId   = connectionId;
            _signals        = new List <string>(signals.Concat(groups));
            _groups         = new DiffSet <string>(groups);
            _logger         = loggerFactory.CreateLogger <Connection>();
            _ackHandler     = ackHandler;
            _counters       = performanceCounterManager;
            _protectedData  = protectedData;
            _excludeMessage = m => ExcludeMessage(m);
            _pool           = pool;
        }
Exemple #6
0
        public Connection(IMessageBus newMessageBus,
                          IJsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IList <string> signals,
                          IList <string> groups,
                          ITraceManager traceManager,
                          IAckHandler ackHandler,
                          IPerformanceCounterManager performanceCounterManager,
                          IProtectedData protectedData)
        {
            if (traceManager == null)
            {
                throw new ArgumentNullException("traceManager");
            }

            _bus           = newMessageBus;
            _serializer    = jsonSerializer;
            _baseSignal    = baseSignal;
            _connectionId  = connectionId;
            _signals       = new List <string>(signals.Concat(groups));
            _groups        = new DiffSet <string>(groups);
            _traceSource   = traceManager["SignalR.Connection"];
            _ackHandler    = ackHandler;
            _counters      = performanceCounterManager;
            _protectedData = protectedData;
        }
Exemple #7
0
        public Connection(IMessageBus newMessageBus,
                          IJsonSerializer jsonSerializer,
                          string baseSignal,
                          string connectionId,
                          IEnumerable <string> signals,
                          IEnumerable <string> groups,
                          ITraceManager traceManager,
                          IAckHandler ackHandler,
                          IPerformanceCounterWriter performanceCounterWriter)
        {
            _bus          = newMessageBus;
            _serializer   = jsonSerializer;
            _baseSignal   = baseSignal;
            _connectionId = connectionId;
            _signals      = new HashSet <string>(signals);
            _groups       = new SafeSet <string>(groups);
            _traceSource  = new Lazy <TraceSource>(() => traceManager["SignalR.Connection"]);
            _ackHandler   = ackHandler;

            var counters = performanceCounterWriter;

            _msgsRecTotalCounter   = counters.GetCounter(PerformanceCounters.ConnectionMessagesReceivedTotal);
            _msgsRecPerSecCounter  = counters.GetCounter(PerformanceCounters.ConnectionMessagesReceivedPerSec);
            _msgsSentTotalCounter  = counters.GetCounter(PerformanceCounters.ConnectionMessagesSentTotal);
            _msgsSentPerSecCounter = counters.GetCounter(PerformanceCounters.ConnectionMessagesSentPerSec);
        }
Exemple #8
0
        public AckSubscriber(IMessageBus messageBus, IAckHandler ackHandler)
        {
            _messageBus = messageBus;
            _ackHandler = ackHandler;

            Identity = Guid.NewGuid().ToString();

            ProcessMessages();
        }
        public AckSubscriber(IMessageBus messageBus, IAckHandler ackHandler)
        {
            _messageBus = messageBus;
            _ackHandler = ackHandler;

            Identity = Guid.NewGuid().ToString();

            ProcessMessages();
        }
        public virtual void Initialize(IDependencyResolver resolver, HostContext context)
        {
            if (_initialized)
            {
                return;
            }

            _newMessageBus = resolver.Resolve <IMessageBus>();
            _connectionIdPrefixGenerator = resolver.Resolve <IConnectionIdPrefixGenerator>();
            _jsonSerializer       = resolver.Resolve <IJsonSerializer>();
            _transportManager     = resolver.Resolve <ITransportManager>();
            _trace                = resolver.Resolve <ITraceManager>();
            _serverMessageHandler = resolver.Resolve <IServerCommandHandler>();
            _counters             = resolver.Resolve <IPerformanceCounterManager>();
            _ackHandler           = resolver.Resolve <IAckHandler>();

            _initialized = true;
        }
Exemple #11
0
 public Connection(IMessageBus newMessageBus,
                   IJsonSerializer jsonSerializer,
                   string baseSignal,
                   string connectionId,
                   IEnumerable<string> signals,
                   IEnumerable<string> groups,
                   ITraceManager traceManager,
                   IAckHandler ackHandler,
                   IPerformanceCounterManager performanceCounterManager)
 {
     _bus = newMessageBus;
     _serializer = jsonSerializer;
     _baseSignal = baseSignal;
     _connectionId = connectionId;
     _signals = new HashSet<string>(signals);
     _groups = new SafeSet<string>(groups);
     _traceSource = new Lazy<TraceSource>(() => traceManager["SignalR.Connection"]);
     _ackHandler = ackHandler;
     _counters = performanceCounterManager;
 }
Exemple #12
0
 public Connection(IMessageBus newMessageBus,
                   IJsonSerializer jsonSerializer,
                   string baseSignal,
                   string connectionId,
                   IEnumerable <string> signals,
                   IEnumerable <string> groups,
                   ITraceManager traceManager,
                   IAckHandler ackHandler,
                   IPerformanceCounterManager performanceCounterManager)
 {
     _bus          = newMessageBus;
     _serializer   = jsonSerializer;
     _baseSignal   = baseSignal;
     _connectionId = connectionId;
     _signals      = new HashSet <string>(signals, StringComparer.OrdinalIgnoreCase);
     _groups       = new SafeSet <string>(groups);
     _traceSource  = new Lazy <TraceSource>(() => traceManager["SignalR.Connection"]);
     _ackHandler   = ackHandler;
     _counters     = performanceCounterManager;
 }
Exemple #13
0
        public virtual void Initialize(IDependencyResolver resolver)
        {
            if (_initialized)
            {
                return;
            }

            _newMessageBus = resolver.Resolve <IMessageBus>();
            _connectionIdPrefixGenerator = resolver.Resolve <IConnectionIdPrefixGenerator>();
            _jsonSerializer       = resolver.Resolve <IJsonSerializer>();
            _transportManager     = resolver.Resolve <ITransportManager>();
            _trace                = resolver.Resolve <ITraceManager>();
            _serverMessageHandler = resolver.Resolve <IServerCommandHandler>();
            _counters             = resolver.Resolve <IPerformanceCounterWriter>();
            _ackHandler           = resolver.Resolve <IAckHandler>();

            _allErrorsTotalCounter  = _counters.GetCounter(PerformanceCounters.ErrorsAllTotal);
            _allErrorsPerSecCounter = _counters.GetCounter(PerformanceCounters.ErrorsAllPerSec);

            _initialized = true;
        }
Exemple #14
0
 public Connection(IMessageBus newMessageBus,
                   IJsonSerializer jsonSerializer,
                   string baseSignal,
                   string connectionId,
                   IList<string> signals,
                   IList<string> groups,
                   ITraceManager traceManager,
                   IAckHandler ackHandler,
                   IPerformanceCounterManager performanceCounterManager,
                   IProtectedData protectedData)
 {
     _bus = newMessageBus;
     _serializer = jsonSerializer;
     _baseSignal = baseSignal;
     _connectionId = connectionId;
     _signals = new HashSet<string>(signals, StringComparer.OrdinalIgnoreCase);
     _groups = new DiffSet<string>(groups);
     _traceSource = new Lazy<TraceSource>(() => traceManager["SignalR.Connection"]);
     _ackHandler = ackHandler;
     _counters = performanceCounterManager;
     _protectedData = protectedData;
 }
Exemple #15
0
 public AckableChatSampleHub(IAckHandler ackHandler)
 {
     _ackHandler = ackHandler;
 }
        public virtual void Initialize(IDependencyResolver resolver)
        {
            if (_initialized)
            {
                return;
            }

            _newMessageBus = resolver.Resolve<IMessageBus>();
            _connectionIdPrefixGenerator = resolver.Resolve<IConnectionIdPrefixGenerator>();
            _jsonSerializer = resolver.Resolve<IJsonSerializer>();
            _transportManager = resolver.Resolve<ITransportManager>();
            _trace = resolver.Resolve<ITraceManager>();
            _serverMessageHandler = resolver.Resolve<IServerCommandHandler>();
            _counters = resolver.Resolve<IPerformanceCounterWriter>();
            _ackHandler = resolver.Resolve<IAckHandler>();

            _allErrorsTotalCounter = _counters.GetCounter(PerformanceCounters.ErrorsAllTotal);
            _allErrorsPerSecCounter = _counters.GetCounter(PerformanceCounters.ErrorsAllPerSec);

            _initialized = true;
        }
        public virtual void Initialize(IDependencyResolver resolver, HostContext context)
        {
            if (_initialized)
            {
                return;
            }

            _newMessageBus = resolver.Resolve<IMessageBus>();
            _configurationManager = resolver.Resolve<IConfigurationManager>();
            _connectionIdPrefixGenerator = resolver.Resolve<IConnectionIdPrefixGenerator>();
            _jsonSerializer = resolver.Resolve<IJsonSerializer>();
            _transportManager = resolver.Resolve<ITransportManager>();
            _trace = resolver.Resolve<ITraceManager>();
            _serverMessageHandler = resolver.Resolve<IServerCommandHandler>();
            _counters = resolver.Resolve<IPerformanceCounterManager>();
            _ackHandler = resolver.Resolve<IAckHandler>();

            _initialized = true;
        }