public static async Task UnregisterHubClientAsync(IHubClient client) { if (_hubClientSet.Remove(client)) { await client.DisconnectHubAsync(); } }
/// <summary> /// Initializes a new instance of the <see cref="QueueApiClient"/> class. /// </summary> /// <param name="apiContract">The api contract.</param> /// <param name="hubClient">The hub client.</param> /// <param name="blobCache">The cache.</param> /// <param name="logger">The logger.</param> public QueueApiClient(IQueueApiContract apiContract, IHubClient <QueuedStoreDto> hubClient, IBlobCache blobCache, ILogManager logger) { _apiContract = apiContract; _hubClient = hubClient; BlobCache = blobCache; _logger = logger.GetLogger(GetType()); }
public JobProcessor(JobSpawner jobSpawner, ResourceAdjuster resourceAdjuster, IHubClient hubClient) { _jobSpawner = jobSpawner; _resourceAdjuster = resourceAdjuster; _hubClient = hubClient; _runningJobs = _runningJobs = new List<ResourceJob>(); }
public SettingsProcessor(Logger logger, IHubClient hubClient, int defaultSendIntervalSeconds, CancellationToken shutdownToken) { _logger = logger; _hubClient = hubClient; _defaultSendIntervalSeconds = defaultSendIntervalSeconds; _shutdownToken = shutdownToken; _monitoredSettingsDataQueue = new BlockingCollection <MessageData>(MonitoredSettingsQueueCapacity); }
public static bool RegisterHubClient(IHubClient client) { bool result = _hubClientSet.Add(client); if (result && (_channel != null)) { client.ConnectHub(_channel); } return(result); }
private void Reinitialize() { _hubClient?.Dispose(); _hubClient = _hubClientFactory.Create(_commandEndpointId); foreach (dynamic adapter in _adapters) { _hubClient.ListenFor(adapter); } }
public void Setup() { _subscription = new Subscription(); _proxyMock = new Mock <IHubProxy>(); _proxyMock.Setup(m => m.Subscribe(It.IsAny <string>())).Returns(_subscription); _connectionMock = new Mock <IConnection>(); _connectionMock.Setup(m => m.State).Returns(ConnectionState.Connected); _subject = new HubClient <ISampleCalls, ISampleEvents>(_proxyMock.Object, _connectionMock.Object); }
public TasksMessagingService( IEventConnectionContext context, ITaskEventAccessor accessor, IHubClient <TasksHub> tasksHubClient, ITasksHubUsersStorage storage) { _context = context; _accessor = accessor; _tasksHubClient = tasksHubClient; _storage = storage; }
public IoTCEventsProcessor(ILogger logger, IHubClient hubClient, uint hubMessageSize, uint hubMessageSizeMax, int timeout, CancellationToken shutdownToken) { _logger = logger; _hubClient = hubClient; _hubMessageSize = hubMessageSize; _hubMessageSizeMax = hubMessageSizeMax; _timeout = timeout; _shutdownToken = shutdownToken; _monitoredIoTcEventDataQueue = new BlockingCollection <MessageData>(MonitoredSettingsIoTcEventCapacity); Initialize(); }
public void Setup() { _subscription = new Subscription(); _proxyMock = new Mock <IHubProxy>(); _proxyMock.Setup(m => m.Subscribe(It.IsAny <string>())).Returns(_subscription); _timeoutValue = TimeSpan.FromSeconds(0.5); _connectionMock = new Mock <IConnection>(); _connectionMock.Setup(m => m.TotalTransportConnectTimeout).Returns(_timeoutValue); _subject = new HubClient <ISampleCalls, ISampleEvents>(_proxyMock.Object, _connectionMock.Object); }
/// <summary> /// Ctor for the class. /// </summary> public IotEdgeHubCommunication() { // connect to IoT Edge hub Logger.Information($"Create module client using '{HubProtocol}' for communication."); IHubClient hubClient = HubClient.CreateModuleClientFromEnvironment(HubProtocol); if (!InitHubCommunicationAsync(hubClient).Result) { string errorMessage = $"Cannot create module client. Exiting..."; Logger.Fatal(errorMessage); throw new Exception(errorMessage); } }
/// <summary> /// Ctor for the class. /// </summary> public IotEdgeHubCommunication(bool registerMethodHandlers, bool listenMessages) { // connect to IoT Edge hub Logger.Information($"Create module client using '{HubProtocol}' for communication."); _hubClient = HubClient.CreateModuleClientFromEnvironment(HubProtocol, Logger); if (!InitHubCommunicationAsync(_hubClient, registerMethodHandlers, listenMessages).Result) { string errorMessage = $"Cannot create module client. Exiting..."; Logger.Fatal(errorMessage); throw new Exception(errorMessage); } }
bool disposedValue; // To detect redundant calls /// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { configUpdateTimer.Stop(); configUpdateTimer.Elapsed -= ConfigUpdateTimer_Elapsed; configUpdateTimer.Dispose(); } hub = null; disposedValue = true; } }
public MotionManager(IHubClient hubClient) { this.hubClient = hubClient; measureTimer.Elapsed += MeasureTimer_Elapsed; measureTimer.Start(); }
public TemperatureManager(IHubClient hubClient) { this.hubClient = hubClient; measureTimer.Elapsed += MeasureTimer_Elapsed; measureTimer.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="RoomManager"/> class. /// </summary> /// <param name="hub">The hub that is used to send updates that may occur in any channels of the rooms.</param> public RoomManager(IHubClient hub) { this.hub = hub; }
private EventHubSink(IHubClient client) { _client = client; Shape = new SinkShape <IEnumerable <EventData> >(In); }