private void CreateConnectionMonitor(NetMQSocket socket, NetMQPoller poller) { _connectionMonitor = new ConnectionMonitor(socket, poller); _connectionMonitor.Connected += ConnectionMonitor_Connected; _connectionMonitor.ConnectRetried += ConnectionMonitor_ConnectRetried; _connectionMonitor.Disconnected += ConnectionMonitor_Disconnected; }
private void DisposeConnectionMonitor() { _connectionMonitor.Connected -= ConnectionMonitor_Disconnected; _connectionMonitor.ConnectRetried -= ConnectionMonitor_ConnectRetried; _connectionMonitor.Disconnected -= ConnectionMonitor_Disconnected; _connectionMonitor.Dispose(); _connectionMonitor = null; }
/// <summary> /// This method initializes the RequestManager for request dispatching with all the configurable elements. /// </summary> /// <param name="theRequestQueue">Queue for the pending requests.</param> /// <param name="theDeadLetterQueue">Queue for the failures.</param> /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param> /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param> public void Initialize( IRequestQueue theRequestQueue, IRequestQueue theDeadLetterQueue, IConnectionMonitor theConnectionMonitor, IEndpointCatalog theEndpointCatalog) { Initialize <RequestDispatcher>(theRequestQueue, theDeadLetterQueue, theConnectionMonitor, theEndpointCatalog); }
/// <summary> /// This method initializes the RequestManager for request dispatching. /// </summary> /// <typeparam name="TRequestDispatcher">The concrete type of an <see cref="IRequestDispatcher"/>.</typeparam> /// <param name="theRequestQueue">Queue for the pending requests.</param> /// <param name="theDeadLetterQueue">Queue for the failures.</param> /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param> /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param> public void Initialize <TRequestDispatcher>( IRequestQueue theRequestQueue, IRequestQueue theDeadLetterQueue, IConnectionMonitor theConnectionMonitor, IEndpointCatalog theEndpointCatalog) where TRequestDispatcher : IRequestDispatcher, new() { Initialize(theRequestQueue, theDeadLetterQueue, theConnectionMonitor, new TRequestDispatcher(), theEndpointCatalog); }
public void Connect() { _socket = new RequestSocket(); _monitor = new DefaultConnectionMonitor(); if (!_monitor.TryConnectAndMonitorSocket(_socket, _address)) { throw new ApplicationException($"Couldn't connect to snapshot address {_address} within timeout {_timeout}"); } }
public RestaurantsViewPresenter(Agent restaurantService, IConnectionMonitor connectionMonitor, IEventAggregator eventAggregator) { _connectionMonitor = connectionMonitor; _restaurantService = restaurantService; _eventAggregator = eventAggregator; // Subscribe to the service agent callback events Callback.GetRestaurantsReturn += GetRestaurantsReturn; Callback.GetRestaurantsException += GetRestaurantsException; }
private void OnConnectionStateChanged(IConnectionMonitor source, bool state) { if (state) { foreach (var synchronizer in _synchronizers) { synchronizer.Init(); } } }
public DeploymentTargetsManagerLinux() { ConnectionMonitor = new ConnectionMonitorUdev(true); ConnectionMonitor.DeviceNew += DeviceNew; ConnectionMonitor.DeviceRemoved += DeviceRemoved; foreach (Connection connection in ConnectionMonitor.GetDeviceList()) { InitalizeMeadow(connection); } }
public DataUpdater(IProjectRepository projectRepository, IActivityRepository activityRepository, IConnectionMonitor connectionMonitor, IEncryptor encryptor) { this.projectRepository = projectRepository; this.encryptor = encryptor; this.connectionMonitor = connectionMonitor; this.activityRepository = activityRepository; SetUpTimer(); this.connectionMonitor.ConnectionStatusChangedEvent += ConnectionMonitorConnectionStatusChangedEvent; IsConnected = this.connectionMonitor.IsConnected; }
public MenuItemsViewPresenter ( [ServiceDependency] Agent restaurantService, [ServiceDependency] IConnectionMonitor connectionMonitor ) { _connectionMonitor = connectionMonitor; _restaurantService = restaurantService; // Subscribe to the service agent callback events Callback.GetMenuItemsReturn += new EventHandler <EventArgs <MenuItem[]> >(GetMenuItemsReturn); Callback.GetMenuItemsException += new EventHandler <EventArgs <Exception> >(GetMenuItemsException); }
public MenuItemsViewPresenter(Agent restaurantService, IConnectionMonitor connectionMonitor, IEventAggregator eventAggregator) { _restaurantService = restaurantService; _connectionMonitor = connectionMonitor; _eventAggregator = eventAggregator; RestaurantSelectedEvent restaurantSelectedEvent = _eventAggregator.GetEvent<RestaurantSelectedEvent>(); restaurantSelectedEvent.Subscribe(RestaurantSelected, ThreadOption.UIThread, true); // Subscribe to the service agent callback events Callback.GetMenuItemsReturn += GetMenuItemsReturn; Callback.GetMenuItemsException += GetMenuItemsException; }
public PublicationDomainService(IPublicationAccess publicationAccess, IConnectionMonitor connectionMonitor, IDeliveryService deliveryService, IAnnotationAccess annotationAccess, INetwork networkService, IPackageAccess packageAccess) { this.publicationAccess = publicationAccess; this.connectionMonitor = connectionMonitor; this.deliveryService = deliveryService; this.annotationAccess = annotationAccess; this.networkService = networkService; this.packageAccess = packageAccess; }
public AnnotationSyncService(ISyncService syncService, IAnnotationAccess annotationAccess, IPublicationAccess publicationAccess, IConnectionMonitor connectionMonitor) { annotationSyncQueue = new Queue <IAnnotationSyncTask>(); this.syncService = syncService; this.annotationAccess = annotationAccess; this.publicationAccess = publicationAccess; this.connectionMonitor = connectionMonitor; actions = new List <ISyncAction> { //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnCategoryTagSyncAction) //, //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnotationDownloadAction), //SyncActionFactory.CreateSyncActionBy(SyncActionName.AnnotationUploadAction) }; }
public void Initialize(ObservableQueue <T> queue, IRequestDispatcher dispatcher, IConnectionMonitor connectionManager, IQueueRepository <T> queueRepository) { pendingData = queue; requestDispatcher = dispatcher; connectionMonitor = connectionManager; this.queueRepository = queueRepository; pendingData.ItemAddedEvent += PendingDataItemAddedEvent; connectionManager.ConnectionStatusChangedEvent += ConnectionManagerConnectionStatusChangedEvent; SetUpBackgroundWorker(); if ((connectionManager.IsConnected) && (!backgroundWorker.IsBusy) && ((PendingData.Count > 0))) { backgroundWorker.RunWorkerAsync(); } }
public ShellPresenter(IShell shell, IEventAggregator eventAggregator, IConnectionMonitor connectionMonitor) { Shell = shell; StatusUpdateEvent statusUpdateEvent = eventAggregator.GetEvent<StatusUpdateEvent>(); statusUpdateEvent.Subscribe(StatusUpdate, ThreadOption.UIThread, true); ProcessingEvent processingEvent = eventAggregator.GetEvent<ProcessingEvent>(); processingEvent.Subscribe(ShowProcessing, ThreadOption.UIThread, true); // Monitor network status changes. _connectionMonitor = connectionMonitor; _connectionMonitor.ConnectionStatusChanged += new EventHandler(OnConnectionStatusChanged); // Show current connectivity state. UpdateConnectivityStatusLabel(_connectionMonitor.IsConnected); }
/// <summary> /// This method initializes the RequestManager for request dispatching with all the configurable elements. /// </summary> /// <param name="theRequestQueue">Queue for the pending requests.</param> /// <param name="theDeadLetterQueue">Queue for the failures.</param> /// <param name="theConnectionMonitor">IConnectionMonitor for connectivity events and info.</param> /// <param name="theRequestDispatcher">Dispatcher to be used by the manager.</param> /// <param name="theEndpointCatalog">Catalog to get the Endpoint especific information for the dispatching.</param> private void Initialize( IRequestQueue theRequestQueue, IRequestQueue theDeadLetterQueue, IConnectionMonitor theConnectionMonitor, IRequestDispatcher theRequestDispatcher, IEndpointCatalog theEndpointCatalog) { Guard.ArgumentNotNull(theRequestQueue, "requestQueue"); Guard.ArgumentNotNull(theDeadLetterQueue, "deadLetterQueue"); Guard.ArgumentNotNull(theConnectionMonitor, "connectionMonitor"); Guard.ArgumentNotNull(theRequestDispatcher, "requestDispatcher"); Guard.ArgumentNotNull(theEndpointCatalog, "endpointCatalog"); requestQueue = theRequestQueue; requestDispatcher = theRequestDispatcher; endpointCatalog = theEndpointCatalog; deadLetterQueue = theDeadLetterQueue; connectionMonitor = theConnectionMonitor; dispatchCommands = new Queue <Command>(); dispatcherRunning = false; }
private void AddServices() { // Set up request manager RequestManager requestManager = DatabaseRequestManagerIntializer.Initialize(); requestManager.StartAutomaticDispatch(); // Monitor network status changes _connectionMonitor = requestManager.ConnectionMonitor; _connectionMonitor.ConnectionStatusChanged += new EventHandler(connectionMonitor_ConnectionStatusChanged); // Show current connectivity state UpdateConnectivityStatusLabel(_connectionMonitor.IsConnected); // Add the request queue to the Root WorkItem. This queue will be used // by service agents to enqueue requests. WorkItem.RootWorkItem.Services.Add(requestManager.RequestQueue); // Add the connection monitor to the Root WorkItem. It will be used // to determine connectivity status and provide feedback to the user // accordingly. WorkItem.RootWorkItem.Services.Add(_connectionMonitor); }
public LoginDomainService(IUserAccess userAccess, IConnectionMonitor connectionMonitor, IAuthenticationService authenticationService) { this.userAccess = userAccess; this.connectionMonitor = connectionMonitor; this.authenticationService = authenticationService; }
/// <summary> /// Creates a ConnectionStatusChangedEventArgs object. /// </summary> /// <param name="connection"></param> public ConnectionStatusChangedEventArgs(IConnectionMonitor connection) { this.connection = connection; }
public LoginUtil(IConnectionMonitor connectionMonitor, ILoginDomainService loginDomainService, ICryptogram cryptogram) { this.connectionMonitor = connectionMonitor; this.loginDomainService = loginDomainService; this.cryptogram = cryptogram; }
public LoginSuccessHandle(IAnnotationSyncService annotationSyncService, IConnectionMonitor connectionMonitor, ITagDomainService annCategoryTagDomainService) { this.annotationSyncService = annotationSyncService; this.connectionMonitor = connectionMonitor; this.annCategoryTagDomainService = annCategoryTagDomainService; }
public NetMqSubscriber(string address, IConnectionMonitor connectionMonitor = null) { Address = address; _connectionMonitor = connectionMonitor ?? new DefaultConnectionMonitor(); }
private void OnConnectionStateChanged(IConnectionMonitor source, bool state) { if (state) { foreach (var synchronizer in _synchronizers) synchronizer.Init(); } }
public void SetConnectionMonitor(IConnectionMonitor monitor) { logger.Debug("Add connection monitor: {0}", monitor.GetType().Name); _connMon = monitor; }
private void OnConnectionStateChanged(IConnectionMonitor source, bool state) { _connectionStateAction(state); }
public PublicationOpeningEventHandle(IConnectionMonitor connection, IPackageAccess packageAccess, IPublicationAccess publicationAccess) { this.connectionMonitor = connection; this.packageAccess = packageAccess; this.publicationAccess = publicationAccess; }