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; }
public void RuntimeInitializeInstance() { _traceManager = string.IsNullOrWhiteSpace(TraceManagerImplementationName) ? StructureMap.ObjectFactory.GetInstance <ITraceManager>() : StructureMap.ObjectFactory.GetNamedInstance <ITraceManager>(TraceManagerImplementationName); _stopwatch = new Stopwatch(); }
protected TransportDisconnectBase(HostContext context, IJsonSerializer jsonSerializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager) { if (context == null) { throw new ArgumentNullException("context"); } if (jsonSerializer == null) { throw new ArgumentNullException("jsonSerializer"); } if (heartbeat == null) { throw new ArgumentNullException("heartbeat"); } if (performanceCounterManager == null) { throw new ArgumentNullException("performanceCounterManager"); } if (traceManager == null) { throw new ArgumentNullException("traceManager"); } _context = context; _jsonSerializer = jsonSerializer; _heartbeat = heartbeat; _counters = performanceCounterManager; _trace = traceManager["SignalR.Transports." + GetType().Name]; }
internal NCacheMessageBus(IDependencyResolver resolver, NCacheScaleoutConfiguration configuration, ICacheProvider connection, bool connectAutomatically) : base(resolver, configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } _connection = connection; _cacheName = configuration.CacheName; _eventKey = configuration.EventKey; _traceManager = resolver.Resolve <ITraceManager>(); _trace = _traceManager["SignalR." + "NCacheMessageBus"]; ReconnectDelay = TimeSpan.FromSeconds(2); if (connectAutomatically) { ThreadPool.QueueUserWorkItem(_ => { var ignore = ConnectWithRetry(); }); } }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="pagedCriteria"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns> public List <BankTransfer> GetPagedTransfers(PagedCriteria pagedCriteria) { try { IBankingManagementService bankingManagement = IoCFactory.Instance.CurrentContainer.Resolve <IBankingManagementService>(); return(bankingManagement.FindBankTransfers(pagedCriteria.PageIndex, pagedCriteria.PageCount)); } catch (ArgumentException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve <ITraceManager>(); traceManager.TraceError(ex.Message); //propagate bussines exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException <ServiceError>(detailedError); } }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="bankAccount"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> public void AddBankAccount(Domain.MainModule.Entities.BankAccount bankAccount) { try { //Resolve root dependency and perform operation IBankingManagementService bankingManagement = IoCFactory.Instance.CurrentContainer.Resolve <IBankingManagementService>(); bankingManagement.AddBankAccount(bankAccount); } catch (ArgumentNullException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve <ITraceManager>(); traceManager.TraceError(ex.Message); //propagate exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException <ServiceError>(detailedError); } }
/// <summary> /// PrepareServiceController ctors /// </summary> /// <param name="prepareService"></param> /// <param name="securityContext"></param> /// <param name="analyzeRepository"></param> public PrepareServiceController(ITraceManager traceManager, IPrepareService prepareService, ISecurityContext securityContext, IKLAnalyzeRepository analyzeRepository) { _traceManager = traceManager; _prepareService = prepareService; _securityContext = securityContext; _analyzeRepository = analyzeRepository; }
protected virtual void Dispose(bool disposing) { // TODO: Dispose the trace listener also. if (disposing) { if (_loadContext != null) { _loadContext.Unloading -= LoadContext_Unloading; _loadContext = null; } _httpTraceSubscription?.Dispose(); _diagListenerSubscription?.Dispose(); _traceManager?.Dispose(); _traceManager = null; _vssTrace?.Dispose(); _vssTrace = null; _trace?.Dispose(); _trace = null; _httpTrace?.Dispose(); _httpTrace = null; _agentShutdownTokenSource?.Dispose(); _agentShutdownTokenSource = null; base.Dispose(); } }
/// <summary> /// Initializes a new instance of the <see cref="SessionValidatorService" /> class. /// </summary> /// <param name="config">The configuration.</param> /// <param name="traceManager">The trace manager.</param> /// <param name="sessionStateProvider">The session state provider.</param> public SessionValidatorService(SessionValidatorConfiguration config, ITraceManager traceManager, ISessionStateProvider sessionStateProvider) { TimeProvider = SystemTime.Current; _traceManager = traceManager; _sessionStateProvider = sessionStateProvider; _config = config; }
public void GetBinding_Wraps_FormatterParameterBinding(bool tracingEnabled) { // Arrange HttpConfiguration config = new HttpConfiguration(); config.Services.Replace( typeof(IAssembliesResolver), new TestAssemblyResolver(new MockAssembly(typeof(PerRequestActionValueBinderTestSampleController)))); if (tracingEnabled) { config.Services.Replace(typeof(ITraceWriter), new Mock <ITraceWriter>().Object); ITraceManager traceManager = config.Services.GetTraceManager(); traceManager.Initialize(config); } IHttpControllerSelector controllerSelector = config.Services.GetHttpControllerSelector(); IHttpActionSelector actionSelector = config.Services.GetActionSelector(); HttpControllerDescriptor controllerDescriptor = controllerSelector.GetControllerMapping()["PerRequestActionValueBinderTestSample"]; HttpActionDescriptor actionDescriptor = actionSelector.GetActionMapping(controllerDescriptor)["Post"].Single(); PerRequestActionValueBinder binder = new PerRequestActionValueBinder(new DefaultActionValueBinder()); // Act HttpActionBinding binding = binder.GetBinding(actionDescriptor); // Assert HttpParameterBinding parameterBinding = binding.ParameterBindings.Where(p => p.Descriptor.ParameterName == "customer").Single(); Assert.True(parameterBinding is PerRequestParameterBinding); }
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); }
private static void DefaultInitializer(HttpConfiguration configuration) { // Register the default IRequiredMemberSelector for formatters that haven't been assigned one ModelMetadataProvider metadataProvider = configuration.Services.GetModelMetadataProvider(); IEnumerable <ModelValidatorProvider> validatorProviders = configuration.Services.GetModelValidatorProviders(); IRequiredMemberSelector defaultRequiredMemberSelector = new ModelValidationRequiredMemberSelector(metadataProvider, validatorProviders); foreach (MediaTypeFormatter formatter in configuration.Formatters) { if (formatter.RequiredMemberSelector == null) { formatter.RequiredMemberSelector = defaultRequiredMemberSelector; } } // Initialize the tracing layer. // This must be the last initialization code to execute // because it alters the configuration and expects no // further changes. As a default service, we know it // must be present. ITraceManager traceManager = configuration.Services.GetTraceManager(); Contract.Assert(traceManager != null); traceManager.Initialize(configuration); }
public FlowManager( IConfiguration configuration, IStateManager stateManager, IContextProvider contextProvider, INamedSemaphore namedSemaphore, IActionProvider actionProvider, ISender sender, IDocumentSerializer documentSerializer, IEnvelopeSerializer envelopeSerializer, IArtificialIntelligenceExtension artificialIntelligenceExtension, IVariableReplacer variableReplacer, ILogger logger, ITraceManager traceManager, IUserOwnerResolver userOwnerResolver, Application application) { _configuration = configuration; _stateManager = stateManager; _contextProvider = contextProvider; _namedSemaphore = namedSemaphore; _actionProvider = actionProvider; _sender = sender; _documentSerializer = documentSerializer; _envelopeSerializer = envelopeSerializer; _artificialIntelligenceExtension = artificialIntelligenceExtension; _variableReplacer = variableReplacer; _logger = logger; _traceManager = traceManager; _userOwnerResolver = userOwnerResolver; _applicationIdentity = application.Identity; }
public Connection(IMessageBus newMessageBus, JsonSerializer jsonSerializer, string baseSignal, string connectionId, IList <string> signals, IList <string> groups, ITraceManager traceManager, IAckHandler ackHandler, IPerformanceCounterManager performanceCounterManager, IProtectedData protectedData, IMemoryPool pool) { 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; _excludeMessage = m => ExcludeMessage(m); _pool = pool; }
public TestHostContext(object testClass, [CallerMemberName] string testName = "") { ArgUtil.NotNull(testClass, nameof(testClass)); ArgUtil.NotNullOrEmpty(testName, nameof(testName)); _testName = testName; // Trim the test assembly's root namespace from the test class's full name. _suiteName = testClass.GetType().FullName.Substring( startIndex: typeof(Tests.Program).FullName.LastIndexOf(nameof(Program))); _suiteName = _suiteName.Replace(".", "_"); // Setup the trace manager. TraceFileName = Path.Combine( IOUtil.GetBinPath(), $"trace_{_suiteName}_{_testName}.log"); if (File.Exists(TraceFileName)) { File.Delete(TraceFileName); } var traceListener = new HostTraceListener(TraceFileName); _secretMasker = new SecretMasker(); _traceManager = new TraceManager(traceListener, _secretMasker); _trace = GetTrace(nameof(TestHostContext)); SetSingleton <ISecretMasker>(_secretMasker); // inject a terminal in silent mode so all console output // goes to the test trace file _term = new Terminal(); _term.Silent = true; SetSingleton <ITerminal>(_term); EnqueueInstance <ITerminal>(_term); }
public Morpher(ITraceManager traceManager, Language lang) { _lang = lang; _traceManager = traceManager; _allomorphTries = new Dictionary <Stratum, RootAllomorphTrie>(); var morphemes = new ObservableList <Morpheme>(); foreach (Stratum stratum in _lang.Strata) { var allomorphs = new HashSet <RootAllomorph>(stratum.Entries.SelectMany(entry => entry.Allomorphs)); var trie = new RootAllomorphTrie(ann => ann.Type() == HCFeatureSystem.Segment); foreach (RootAllomorph allomorph in allomorphs) { trie.Add(allomorph); } _allomorphTries[stratum] = trie; morphemes.AddRange(stratum.Entries); morphemes.AddRange(stratum.MorphologicalRules.OfType <AffixProcessRule>()); morphemes.AddRange(stratum.AffixTemplates.SelectMany(t => t.Slots).SelectMany(s => s.Rules).Distinct()); } _analysisRule = lang.CompileAnalysisRule(this); _synthesisRule = lang.CompileSynthesisRule(this); MaxStemCount = 2; LexEntrySelector = entry => true; RuleSelector = rule => true; _morphemes = new ReadOnlyObservableCollection <Morpheme>(morphemes); }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="customer"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> public void RemoveCustomer(Customer customer) { try { ICustomerManagementService customerService = IoCFactory.Instance.CurrentContainer.Resolve <ICustomerManagementService>(); customerService.RemoveCustomer(customer); } catch (ArgumentNullException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve <ITraceManager>(); traceManager.TraceError(ex.Message); //propagate exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException <ServiceError>(detailedError); } }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/> /// </summary> /// <param name="countryName"><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></param> /// <returns><see cref="Microsoft.Samples.NLayerApp.DistributedServices.MainModule.IMainModuleService"/></returns> public List <Country> GetCountriesByName(string countryName) { try { //Resolve root dependencies and perform operations ICustomerManagementService countryService = IoCFactory.Instance.CurrentContainer.Resolve <ICustomerManagementService>(); return(countryService.FindCountriesByName(countryName)); } catch (ArgumentException ex) { //trace data for internal health system and return specific FaultException here! //Log and throw is a knowed anti-pattern but in this point ( entry point for clients this is admited!) //log exception for manage health system ITraceManager traceManager = IoCFactory.Instance.CurrentContainer.Resolve <ITraceManager>(); traceManager.TraceError(ex.Message); //propagate exception to client ServiceError detailedError = new ServiceError() { ErrorMessage = Resources.Messages.exception_InvalidArguments }; throw new FaultException <ServiceError>(detailedError); } }
internal RedisMessageBus(IDependencyResolver resolver, RedisScaleoutConfiguration configuration, IRedisConnection connection, bool connectAutomatically) : base(resolver, configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } _connection = connection; _connection.ConnectionFailed += OnConnectionFailed; _connection.ConnectionRestored += OnConnectionRestored; _connection.ErrorMessage += OnConnectionError; _connectionString = configuration.ConnectionString; _db = configuration.Database; _key = configuration.EventKey; _traceManager = resolver.Resolve <ITraceManager>(); _messageEncryptor = resolver.Resolve <IMessageEncryptor>(); _trace = _traceManager["SignalR." + nameof(RedisMessageBus)]; ReconnectDelay = TimeSpan.FromSeconds(2); if (connectAutomatically) { ThreadPool.QueueUserWorkItem(_ => { var ignore = ConnectWithRetry(); }); } }
protected TransportDisconnectBase(HostContext context, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager) { if (context == null) { throw new ArgumentNullException("context"); } if (heartbeat == null) { throw new ArgumentNullException("heartbeat"); } if (performanceCounterManager == null) { throw new ArgumentNullException("performanceCounterManager"); } if (traceManager == null) { throw new ArgumentNullException("traceManager"); } _context = context; _heartbeat = heartbeat; _counters = performanceCounterManager; // Queue to protect against overlapping writes to the underlying response stream WriteQueue = new TaskQueue(); _trace = traceManager["SignalR.Transports." + GetType().Name]; }
public ProductLicenseManager(ITraceManager traceManager, string publicXmlKey) : this(traceManager, publicXmlKey, new IsolatedStorageStore(), new MachineIdentifierProvider( traceManager, new MachineMultiFootPrintIdentifierV3(traceManager), new MachineMultiFootPrintIdentifierV2(traceManager)), new UserInformationProvider(true)) { }
public AuthorizationService( IUnitOfWork unitOfWork, ISymmetricAlgorithmProvider symmetricAlgorithmProvider, ITraceManager traceManager) : base(unitOfWork, symmetricAlgorithmProvider) { this._traceManager = traceManager; }
/// <summary> /// /// </summary> /// <param name="traceManager"></param> public MessageBus(ITraceManager traceManager) { _trace = traceManager; _engine = new Engine(_topics) { Trace = Trace }; }
private void Dispose(bool disposing) { if (disposing) { _traceManager?.Dispose(); _traceManager = null; } }
public static ITraceProxy GetTracer(string traceName) { ITraceManager tm = TraceManager.Instance as ITraceManager; ITrace trace = tm.CreateTracer(traceName); ITraceProxy traceProxy = new ITraceProxy(trace); return(traceProxy); }
public HomeController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, ILocalizedStrings localizedStrings, ILocalizationManager localizationManager) : base(localizationManager) { _applicationUsersService = applicationUsersService; _traceManager = traceManager; _localizedStrings = localizedStrings; }
public ScaleoutSubscription(string identity, IList <string> eventKeys, string cursor, IList <ScaleoutMappingStore> streams, Func <MessageResult, object, Task <bool> > callback, int maxMessages, ITraceManager traceManager, IPerformanceCounterManager counters, object state) : base(identity, eventKeys, callback, maxMessages, counters, state) { if (streams == null) { throw new ArgumentNullException("streams"); } if (traceManager == null) { throw new ArgumentNullException(nameof(traceManager)); } _streams = streams; List <Cursor> cursors = null; if (String.IsNullOrEmpty(cursor)) { cursors = new List <Cursor>(); } else { cursors = Cursor.GetCursors(cursor, _scaleoutCursorPrefix); // If the cursor had a default prefix, "d-", cursors might be null if (cursors == null) { cursors = new List <Cursor>(); } // If the streams don't match the cursors then throw it out else if (cursors.Count != _streams.Count) { cursors.Clear(); } } // No cursors so we need to populate them from the list of streams if (cursors.Count == 0) { for (int streamIndex = 0; streamIndex < _streams.Count; streamIndex++) { AddCursorForStream(streamIndex, cursors); } } _cursors = cursors; _trace = traceManager["SignalR." + typeof(ScaleoutSubscription).Name]; }
public WebSocketTransport(HostContext context, IJsonSerializer serializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterWriter, ITraceManager traceManager) : base(context, serializer, heartbeat, performanceCounterWriter, traceManager) { _context = context; }
public AuthenticationService( IUnitOfWork unitOfWork, ISymmetricAlgorithmProvider symmetricAlgorithmProvider, ITraceManager traceManager) : base(unitOfWork, symmetricAlgorithmProvider) { this._priorAuthenticationRequired = false; this._traceManager = traceManager; }
private void Dispose(bool disposing) { // TODO: Dispose the trace listener also. if (disposing) { _traceManager?.Dispose(); _traceManager = null; } }
public UtilsController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, ILocalizedStrings localizedStrings, IAPIHttpClient apiHttpClient, ILocalizationManager localizationManager) : base(localizationManager) { _applicationUsersService = applicationUsersService; _traceManager = traceManager; _localizedStrings = localizedStrings; _apiHttpClient = apiHttpClient; }
public NotificationService( ISecurityContext securityContext, ILocalizationManager localizationManager, ITraceManager traceManager) { _securityContext = securityContext; _localizationManager = localizationManager; _traceManager = traceManager; }
public virtual void Repository_ConstructorWithNullContainerThrowNewArgumentNullException_Test() { //Arrange IQueryableUnitOfWork unitOfWork = null; ITraceManager traceManager = this.GetTraceManager(); //Act Repository <TEntity> repository = new Repository <TEntity>(unitOfWork, traceManager); }
public void FindBanksAccounts_Invoke_NullSpecThrowNewArgumentNullException_Test() { //Arrange IMainModuleUnitOfWork context = this.GetUnitOfWork(); ITraceManager traceManager = this.GetTraceManager(); BankAccountRepository repository = new BankAccountRepository(context, traceManager); repository.GetBySpec(null); }
public InProcessMessageBus(ITraceManager traceManager, bool garbageCollectMessages) { _trace = traceManager; if (garbageCollectMessages) { _timer = new Timer(RemoveExpiredEntries, null, _cleanupInterval, _cleanupInterval); } }
public UISettingsService( ISecurityContext securityContext, ILocalizationManager localizationManager, ITraceManager traceManager) { _securityContext = securityContext; _localizationManager = localizationManager; _traceManager = traceManager; }
public LicenseController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, IAPIHttpClient apiHttpClient, ISystemInformationService systemInformationService, ILocalizationManager localizationManager) : base(localizationManager) { _applicationUsersService = applicationUsersService; _apiHttpClient = apiHttpClient; _systemInformationService = systemInformationService; _traceManager = traceManager; }
public LongPollingTransport(HostContext context, JsonSerializer jsonSerializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager, IConfigurationManager configurationManager) : base(context, jsonSerializer, heartbeat, performanceCounterManager, traceManager) { _configurationManager = configurationManager; }
private TestLongPollingTransport( HostContext context, JsonSerializer json, ITransportHeartbeat heartBeat, IPerformanceCounterManager counters, ITraceManager traceManager, IConfigurationManager configuarionManager) : base(context, json, heartBeat, counters, traceManager, configuarionManager) { }
/// <summary> /// /// </summary> /// <param name="traceManager"></param> public MessageBus(ITraceManager traceManager, IPerformanceCounterManager performanceCounterManager) { _trace = traceManager; _counters = performanceCounterManager; _broker = new MessageBroker(_topics, _counters) { Trace = Trace }; }
public LongPollingTransport(HostContext context, IJsonSerializer jsonSerializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager) : base(context, heartbeat, performanceCounterManager, traceManager) { _jsonSerializer = jsonSerializer; _counters = performanceCounterManager; }
/// <summary> /// Creates a new instance. /// </summary> public PerformanceCounterManager(ITraceManager traceManager) : this() { if (traceManager == null) { throw new ArgumentNullException("traceManager"); } _trace = traceManager["SignalR.PerformanceCounterManager"]; }
protected ForeverTransport(HostContext context, IJsonSerializer jsonSerializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterWriter, ITraceManager traceManager) : base(context, jsonSerializer, heartbeat, performanceCounterWriter, traceManager) { _jsonSerializer = jsonSerializer; _counters = performanceCounterWriter; }
public MessageBus(IStringMinifier stringMinifier, ITraceManager traceManager, IPerformanceCounterManager performanceCounterManager, IConfigurationManager configurationManager, int maxTopicsWithNoSubscriptions) { if (stringMinifier == null) { throw new ArgumentNullException("stringMinifier"); } if (traceManager == null) { throw new ArgumentNullException("traceManager"); } if (performanceCounterManager == null) { throw new ArgumentNullException("performanceCounterManager"); } if (configurationManager == null) { throw new ArgumentNullException("configurationManager"); } if (configurationManager.DefaultMessageBufferSize < 0) { throw new ArgumentOutOfRangeException(Resources.Error_BufferSizeOutOfRange); } _stringMinifier = stringMinifier; _traceManager = traceManager; Counters = performanceCounterManager; _trace = _traceManager["SignalR." + typeof(MessageBus).Name]; _maxTopicsWithNoSubscriptions = maxTopicsWithNoSubscriptions; _gcTimer = new Timer(_ => GarbageCollectTopics(), state: null, dueTime: _gcInterval, period: _gcInterval); _broker = new MessageBroker(Counters) { Trace = _trace }; // The default message store size _messageStoreSize = (uint)configurationManager.DefaultMessageBufferSize; _topicTtl = configurationManager.TopicTtl(); _createTopic = CreateTopic; _addEvent = AddEvent; _removeEvent = RemoveEvent; _disposeSubscription = o => DisposeSubscription(o); Topics = new TopicLookup(); }
protected PersistentConnection(IMessageBus messageBus, IConnectionIdFactory connectionIdFactory, IJsonSerializer jsonSerializer, ITransportManager transportManager, ITraceManager traceManager) { _messageBus = messageBus; _connectionIdFactory = connectionIdFactory; _jsonSerializer = jsonSerializer; _transportManager = transportManager; _trace = traceManager; }
public WebSocketTransport(HostContext context, JsonSerializer serializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterWriter, ITraceManager traceManager) : base(context, serializer, heartbeat, performanceCounterWriter, traceManager) { _context = context; _message = OnMessage; _closed = OnClosed; _error = OnError; }
protected ForeverTransport(HostContext context, JsonSerializer jsonSerializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager, IMemoryPool pool) : base(context, heartbeat, performanceCounterManager, traceManager) { Pool = pool; _jsonSerializer = jsonSerializer; _counters = performanceCounterManager; }
/// <summary> /// /// </summary> /// <param name="traceManager"></param> public MessageBus(ITraceManager traceManager, IPerformanceCounterWriter performanceCounterWriter) { _trace = traceManager; _counters = performanceCounterWriter; _msgsTotalCounter = _counters.GetCounter(PerformanceCounters.MessageBusMessagesPublishedTotal); _msgsPerSecCounter = _counters.GetCounter(PerformanceCounters.MessageBusMessagesPublishedPerSec); _engine = new Engine(_topics, _counters) { Trace = Trace }; }
/// <summary> /// Initializes and instance of the <see cref="TransportHeartBeat"/> class. /// </summary> /// <param name="resolver">The <see cref="IDependencyResolver"/>.</param> public TransportHeartBeat(IDependencyResolver resolver) { _configurationManager = resolver.Resolve<IConfigurationManager>(); _serverCommandHandler = resolver.Resolve<IServerCommandHandler>(); _serverId = resolver.Resolve<IServerIdManager>().ServerId; _trace = resolver.Resolve<ITraceManager>(); _serverCommandHandler.Command = ProcessServerCommand; // REVIEW: When to dispose the timer? _timer = new Timer(Beat, null, _configurationManager.HeartBeatInterval, _configurationManager.HeartBeatInterval); }
public virtual void Initialize(IDependencyResolver resolver) { if (_initialized) { return; } _messageBus = resolver.Resolve<IMessageBus>(); _connectionIdFactory = resolver.Resolve<IConnectionIdFactory>(); _jsonSerializer = resolver.Resolve<IJsonSerializer>(); _transportManager = resolver.Resolve<ITransportManager>(); _trace = resolver.Resolve<ITraceManager>(); _initialized = true; }
public Connection(IMessageBus messageBus, IJsonSerializer jsonSerializer, string baseSignal, string connectionId, IEnumerable<string> signals, IEnumerable<string> groups, ITraceManager traceManager) { _messageBus = messageBus; _serializer = jsonSerializer; _baseSignal = baseSignal; _connectionId = connectionId; _signals = new HashSet<string>(signals); _groups = new HashSet<string>(groups); _trace = traceManager; }
public virtual void Initialize(IDependencyResolver resolver) { if (_initialized) { return; } _newMessageBus = resolver.Resolve<INewMessageBus>(); _connectionIdGenerator = resolver.Resolve<IConnectionIdGenerator>(); _jsonSerializer = resolver.Resolve<IJsonSerializer>(); _transportManager = resolver.Resolve<ITransportManager>(); _trace = resolver.Resolve<ITraceManager>(); _serverMessageHandler = resolver.Resolve<IServerCommandHandler>(); _initialized = true; }
public Connection(INewMessageBus newMessageBus, IJsonSerializer jsonSerializer, string baseSignal, string connectionId, IEnumerable<string> signals, IEnumerable<string> groups, ITraceManager traceManager) { _bus = newMessageBus; _serializer = jsonSerializer; _baseSignal = baseSignal; _connectionId = connectionId; _signals = new HashSet<string>(signals); _groups = new HashSet<string>(groups); _traceSource = new Lazy<TraceSource>(() => traceManager["SignalR.Connection"]); }
/// <summary> /// /// </summary> /// <param name="traceManager"></param> /// <param name="performanceCounterManager"></param> public MessageBus(IStringMinifier stringMinifier, ITraceManager traceManager, IPerformanceCounterManager performanceCounterManager, IConfigurationManager configurationManager) { _stringMinifier = stringMinifier; _trace = traceManager; _counters = performanceCounterManager; _gcTimer = new Timer(_ => CheckTopics(), state: null, dueTime: _gcInterval, period: _gcInterval); _broker = new MessageBroker(_counters) { Trace = Trace }; // Keep topics alive for as long as we let connections wait until they are disconnected. // This should be a good enough estimate for how long until we should consider a topic dead. _topicTtl = configurationManager.DisconnectTimeout; }
public WebSocketTransport(HostContext context, JsonSerializer serializer, ITransportHeartbeat heartbeat, IPerformanceCounterManager performanceCounterManager, ITraceManager traceManager, int? maxIncomingMessageSize) : base(context, serializer, heartbeat, performanceCounterManager, traceManager) { _context = context; _maxIncomingMessageSize = maxIncomingMessageSize; _message = OnMessage; _closed = OnClosed; _error = OnSocketError; _counters = performanceCounterManager; }
public MessageBus(IStringMinifier stringMinifier, ITraceManager traceManager, IPerformanceCounterManager performanceCounterManager, IConfigurationManager configurationManager) { if (stringMinifier == null) { throw new ArgumentNullException("stringMinifier"); } if (traceManager == null) { throw new ArgumentNullException("traceManager"); } if (performanceCounterManager == null) { throw new ArgumentNullException("performanceCounterManager"); } if (configurationManager == null) { throw new ArgumentNullException("configurationManager"); } _stringMinifier = stringMinifier; _traceManager = traceManager; Counters = performanceCounterManager; _trace = _traceManager["SignalR.MessageBus"]; _gcTimer = new Timer(_ => CheckTopics(), state: null, dueTime: _gcInterval, period: _gcInterval); _broker = new MessageBroker(Counters) { Trace = Trace }; // Keep topics alive for twice as long as we let connections to reconnect. // Also add twice the keepalive interval since clients might take a while to notice they are disconnected. // This should be a good enough estimate for how long until we should consider a topic dead. var keepAlive = configurationManager.KeepAlive ?? TimeSpan.Zero; _topicTtl = TimeSpan.FromTicks((configurationManager.DisconnectTimeout.Ticks + keepAlive.Ticks) * 2); Topics = new ConcurrentDictionary<string, Topic>(); }
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; }
public MessageBus(IStringMinifier stringMinifier, ITraceManager traceManager, IPerformanceCounterManager performanceCounterManager, IConfigurationManager configurationManager) { if (stringMinifier == null) { throw new ArgumentNullException("stringMinifier"); } if (traceManager == null) { throw new ArgumentNullException("traceManager"); } if (performanceCounterManager == null) { throw new ArgumentNullException("performanceCounterManager"); } if (configurationManager == null) { throw new ArgumentNullException("configurationManager"); } _stringMinifier = stringMinifier; _traceManager = traceManager; Counters = performanceCounterManager; _trace = _traceManager["SignalR.MessageBus"]; _gcTimer = new Timer(_ => CheckTopics(), state: null, dueTime: _gcInterval, period: _gcInterval); _broker = new MessageBroker(Counters) { Trace = Trace }; // Keep topics alive for as long as we let connections wait until they are disconnected. // This should be a good enough estimate for how long until we should consider a topic dead. _topicTtl = configurationManager.DisconnectTimeout; Topics = new ConcurrentDictionary<string, Topic>(); }