Exemple #1
0
        private Azure(RestClient restClient, string subscriptionId, string tenantId, IAuthenticated authenticated)
        {
            resourceManager          = ResourceManager.Fluent.ResourceManager.Authenticate(restClient).WithSubscription(subscriptionId);
            storageManager           = StorageManager.Authenticate(restClient, subscriptionId);
            computeManager           = ComputeManager.Authenticate(restClient, subscriptionId);
            networkManager           = NetworkManager.Authenticate(restClient, subscriptionId);
            batchManager             = BatchManager.Authenticate(restClient, subscriptionId);
            keyVaultManager          = KeyVaultManager.Authenticate(restClient, subscriptionId, tenantId);
            trafficManager           = TrafficManager.Fluent.TrafficManager.Authenticate(restClient, subscriptionId);
            dnsZoneManager           = DnsZoneManager.Authenticate(restClient, subscriptionId);
            sqlManager               = SqlManager.Authenticate(restClient, subscriptionId);
            redisManager             = RedisManager.Authenticate(restClient, subscriptionId);
            cdnManager               = CdnManager.Authenticate(restClient, subscriptionId);
            appServiceManager        = AppServiceManager.Authenticate(restClient, subscriptionId, tenantId);
            searchManager            = SearchManager.Authenticate(restClient, subscriptionId);
            serviceBusManager        = ServiceBusManager.Authenticate(restClient, subscriptionId);
            containerInstanceManager = ContainerInstanceManager.Authenticate(restClient, subscriptionId);
            registryManager          = RegistryManager.Authenticate(restClient, subscriptionId);
            containerServiceManager  = ContainerServiceManager.Authenticate(restClient, subscriptionId);
            cosmosDBManager          = CosmosDBManager.Authenticate(restClient, subscriptionId);
            authorizationManager     = AuthorizationManager.Authenticate(restClient, subscriptionId);
            msiManager               = MsiManager.Authenticate(restClient, subscriptionId);
            batchAIManager           = BatchAIManager.Authenticate(restClient, subscriptionId);
            monitorManager           = MonitorManager.Authenticate(restClient, subscriptionId);
            eventHubManager          = EventHubManager.Authenticate(restClient, subscriptionId);

            SubscriptionId     = subscriptionId;
            this.authenticated = authenticated;
        }
Exemple #2
0
        private void InitSystem()
        {
            this.Icon = BitmapFrame.Create(this.GetImageResourceStream("main.ico"));

            _uiState = SbmqSystem.UIState;
            RestoreWindowState();

            this.IsEnabled       = false;
            lbLoading.Visibility = System.Windows.Visibility.Visible;

            BackgroundWorker w = new BackgroundWorker();

            w.DoWork += (s, e) => {
                try {
                    _sys = SbmqSystem.Create();
                    _sys.ItemsChanged   += sys_ItemsChanged;
                    _sys.ErrorOccured   += _sys_ErrorOccured;
                    _sys.WarningOccured += _sys_WarningOccured;
                    _mgr = _sys.Manager;
                } catch (Exception ex) {
                    Dispatcher.Invoke(DispatcherPriority.Normal,
                                      new Action(() => { LogError("Failed to initialize System", ex, true); }));
                }
            };

            w.RunWorkerCompleted += (s, e) => {
                RestoreQueueButtonsState();
                this.IsEnabled       = true;
                lbLoading.Visibility = System.Windows.Visibility.Hidden;


                btnSendCommand.IsEnabled       = _sys.CanSendCommand;
                btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

                lbItems.ItemsSource = _sys.Items;

                SetupContextMenu();

                UpdateNotifyIconText();

                if (_sys.Config.StartCount == 1)
                {
                    ShowConfigDialog();
                }
                else if (_sys.Config.VersionCheck.Enabled)
                {
                    if (_sys.Config.VersionCheck.LastCheck < DateTime.Now.AddDays(-14))
                    {
                        CheckIfLatestVersion(false);
                    }
                }

                UpdateTitle();

                _sys.StartMonitoring();
            };

            w.RunWorkerAsync();
        }
        private static async Task SendMessages(IServiceBusManager serviceBusManager)
        {
            string label1 = "First";
            string json1  = @"{'Name':'James'}";

            string label2 = "Second";
            string json2  = @"{'Name':'James'}";

            await serviceBusManager.SendMessage(label1, json1);

            await Task.Delay(3);

            await serviceBusManager.SendMessage(label2, json2);
        }
 /// <summary>
 /// Default ctor used at runtime
 /// </summary>
 /// <param name="context"></param>
 /// <param name="bigBrother"></param>
 /// <param name="serviceBusManager"></param>
 /// <param name="proxyFactory"></param>
 /// <param name="settings"></param>
 public EventReaderService(
     StatefulServiceContext context,
     IBigBrother bigBrother,
     IServiceBusManager serviceBusManager,
     IActorProxyFactory proxyFactory,
     ConfigurationSettings settings)
     : base(context)
 {
     _bigBrother        = bigBrother;
     _serviceBusManager = serviceBusManager;
     _proxyFactory      = proxyFactory;
     _settings          = settings;
     ParseOutInitData(context.InitializationData);
 }
 ///GENMHASH:C2117B189F9FA822914F24C24F37E1E4:18F16B53FD5A60D0DAF2DBAB78D6BEE7
 internal NamespaceAuthorizationRuleImpl(string resourceGroupName,
                                         string namespaceName,
                                         string name,
                                         Region region,
                                         SharedAccessAuthorizationRuleInner inner,
                                         IServiceBusManager manager) : base(name, inner, manager)
 {
     this.region = region;
     this.WithExistingParentResource(resourceGroupName, namespaceName);
     if (inner.Location == null)
     {
         inner.Location = this.region.ToString();
     }
 }
        private void RestartSystem()
        {
            this.IsEnabled      = false;
            lbItems.ItemsSource = null;

            BackgroundWorker w = new BackgroundWorker();

            w.DoWork += (s, e) => {
                try {
                    _sys.SwitchServiceBus(_sys.Config.ServiceBus, _sys.Config.ServiceBusVersion, _sys.Config.ServiceBusQueueType);
                    _mgr = _sys.Manager;
                } catch (RestartRequiredException) {
                    e.Cancel = true;
                }
            };

            w.RunWorkerCompleted += (s, e) => {
                if (!e.Cancelled)
                {
                    this.IsEnabled = true;
                    RestoreMonitorQueueState();

                    btnSendCommand.IsEnabled       = _sys.CanSendCommand;
                    btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

                    lbItems.ItemsSource = _sys.Items;

                    if (!lbItems.IsEnabled)
                    {
                        lbItems.IsEnabled = true;
                    }

                    SetupContextMenu();

                    UpdateTitle();

                    _sys.StartMonitoring();
                }
                else // Restart needed

                {
                    System.Diagnostics.Process.Start(Application.ResourceAssembly.Location, "-f");
                    Application.Current.Shutdown();
                }
            };

            w.RunWorkerAsync();
        }
Exemple #7
0
        private void RestartSystem()
        {
            _timer.Stop();

            if (_sys != null)
            {
                _sys.Manager.Terminate();
            }

            this.IsEnabled      = false;
            lbItems.ItemsSource = null;

            BackgroundWorker w = new BackgroundWorker();

            w.DoWork += (s, e) => {
                _sys = SbmqSystem.Create();
                _sys.ItemsChanged += MessageMgr_ItemsChanged;

                _mgr = _sys.Manager;
            };

            w.RunWorkerCompleted += (s, e) => {
                this.IsEnabled = true;
                RestoreMonitorQueueState();

                btnSendCommand.IsEnabled       = _sys.CanSendCommand;
                btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

                lbItems.ItemsSource = _sys.Items;

                SetupContextMenu();

                timer_Tick(this, EventArgs.Empty);

                _timer.Interval = TimeSpan.FromMilliseconds(_sys.Config.MonitorInterval);
                _timer.Start();
            };

            w.RunWorkerAsync();
        }
Exemple #8
0
        private void Initialize()
        {
            AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve;
            _monitorState = new SbmqmMonitorState();

            Config = SystemConfig.Load();

            Config.StartCount += 1;

            _mgr = ServiceBusFactory.CreateManager(Config.MessageBus, Config.MessageBusQueueType);
            _mgr.ErrorOccured += System_ErrorOccured;
            _mgr.ItemsChanged += System_ItemsChanged;

            _mgr.Initialize(Config.MonitorServer, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);

            CanSendCommand       = (_mgr as ISendCommand) != null;
            CanViewSubscriptions = (_mgr as IViewSubscriptions) != null;

            _history = new CommandHistoryManager(Config);

            AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
        }
Exemple #9
0
        private void RestartSystem()
        {
            StopMonitoring();

            if (_sys != null)
            {
                _sys.Manager.Terminate();
            }

            this.IsEnabled      = false;
            lbItems.ItemsSource = null;

            BackgroundWorker w = new BackgroundWorker();

            w.DoWork += (s, e) => {
                _sys = SbmqSystem.Create();
                _sys.ItemsChanged += MessageMgr_ItemsChanged;

                _mgr = _sys.Manager;
            };

            w.RunWorkerCompleted += (s, e) => {
                this.IsEnabled = true;
                RestoreMonitorQueueState();

                btnSendCommand.IsEnabled       = _sys.CanSendCommand;
                btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

                lbItems.ItemsSource = _sys.Items;

                SetupContextMenu();

                RestartMonitoring();
            };

            w.RunWorkerAsync();
        }
        private void CreateServiceBusManager(string serviceBus, string version, string queueType)
        {
            _mgr = ServiceBusFactory.CreateManager(serviceBus, version, queueType);
            _mgr.ErrorOccured   += System_ErrorOccured;
            _mgr.WarningOccured += System_WarningOccured;
            _mgr.ItemsChanged   += System_ItemsChanged;

            var cmdSender = (_mgr as ISendCommand);

            if (cmdSender != null)
            {
                cmdSender.CommandContentFormat = Config.CurrentServer.CommandContentType;
            }

            lock (_itemsLock)
                _items.Clear();

            _mgr.Initialize(Config.CurrentServer.ConnectionSettings, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);

            CanSendCommand       = (_mgr as ISendCommand) != null;
            CanViewSubscriptions = (_mgr as IViewSubscriptions) != null;

            _serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
        }
Exemple #11
0
 public GetResourcesQueryHandler(IServiceBusManager serviceBusManager)
 {
     _serviceBusManager = serviceBusManager;
 }
        private void RestartSystem()
        {
            StopMonitoring();

              if( _sys != null )
            _sys.Manager.Terminate();

              this.IsEnabled = false;
              lbItems.ItemsSource = null;

              BackgroundWorker w = new BackgroundWorker();
              w.DoWork += (s, e) => {
            _sys = SbmqSystem.Create();
            _sys.ItemsChanged += MessageMgr_ItemsChanged;

            _mgr = _sys.Manager;
              };

              w.RunWorkerCompleted += (s, e) => {

            this.IsEnabled = true;
            RestoreMonitorQueueState();

            btnSendCommand.IsEnabled = _sys.CanSendCommand;
            btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

            lbItems.ItemsSource = _sys.Items;

            SetupContextMenu();

            RestartMonitoring();
              };

              w.RunWorkerAsync();
        }
        private void InitSystem()
        {
            this.Icon = BitmapFrame.Create(this.GetImageResourceStream("main.ico"));

              _uiState = SbmqSystem.UIState;
              RestoreWindowState();

              this.IsEnabled = false;
              lbLoading.Visibility = System.Windows.Visibility.Visible;

              BackgroundWorker w = new BackgroundWorker();
              w.DoWork += (s, e) => {
            try {
              _sys = SbmqSystem.Create();
              _sys.ItemsChanged += sys_ItemsChanged;
              _sys.ErrorOccured += _sys_ErrorOccured;
              _sys.WarningOccured += _sys_WarningOccured;

              _sys.StartedLoadingQueues += _sys_StartedLoadingQueues;
              _sys.FinishedLoadingQueues += _sys_FinishedLoadingQueues;

              _features = _sys.GetDiscoveryService().Features;

              _mgr = _sys.Manager;

            } catch( Exception ex ) {

              Dispatcher.Invoke(DispatcherPriority.Normal,
                            new Action(() => { LogError("Failed to initialize System", ex, true); }));

            }
              };

              w.RunWorkerCompleted += (s, e) => {

            RestoreQueueButtonsState();
            this.IsEnabled = true;

            btnSendCommand.IsEnabled = _sys.CanSendCommand;
            btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

            lbItems.ItemsSource = _sys.Items;
            if( !lbItems.IsEnabled )
              lbItems.IsEnabled = true;

            SetupContextMenu();

            UpdateNotifyIconText();

            if( _sys.Config.StartCount == 1 ) {
              ShowConfigDialog();

            } else if( _sys.Config.VersionCheck.Enabled ) {
              if( _sys.Config.VersionCheck.LastCheck < DateTime.Now.AddDays(-14) )
            CheckIfLatestVersion(false);
            }

            UpdateTitle();

            _sys.StartMonitoring();

            lbLoading.Visibility = System.Windows.Visibility.Hidden;
              };

              w.RunWorkerAsync();
        }
        private void Initialize()
        {
            AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve;
              _monitorState = new SbmqmMonitorState();

              Config = SystemConfig.Load();

              Config.StartCount += 1;

              _mgr = ServiceBusFactory.CreateManager(Config.MessageBus, Config.MessageBusQueueType);
              _mgr.ErrorOccured += System_ErrorOccured;
              _mgr.WarningOccured += System_WarningOccured;
              _mgr.ItemsChanged += System_ItemsChanged;

              _mgr.Initialize(Config.MonitorServer, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);

              CanSendCommand = ( _mgr as ISendCommand ) != null;
              CanViewSubscriptions = ( _mgr as IViewSubscriptions ) != null;

              _history = new CommandHistoryManager(Config);

              AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
        }
        private void RestartSystem()
        {
            _timer.Stop();

              if( _sys != null )
            _sys.Manager.Terminate();

              this.IsEnabled = false;
              lbItems.ItemsSource = null;

              BackgroundWorker w = new BackgroundWorker();
              w.DoWork += (s, e) => {
            _sys = SbmqSystem.Create();
            _sys.ItemsChanged += MessageMgr_ItemsChanged;

            _mgr = _sys.Manager;
              };

              w.RunWorkerCompleted += (s, e) => {

            this.IsEnabled = true;
            RestoreMonitorQueueState();

            btnSendCommand.IsEnabled = _sys.CanSendCommand;
            btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

            lbItems.ItemsSource = _sys.Items;

            SetupContextMenu();

            timer_Tick(this, EventArgs.Empty);

            _timer.Interval = TimeSpan.FromMilliseconds(_sys.Config.MonitorInterval);
            _timer.Start();
              };

              w.RunWorkerAsync();
        }
Exemple #16
0
 public GetSubscriptionsHttp(IServiceBusManager serviceBusManager)
 {
     _serviceBusManager = serviceBusManager;
 }
        private void CreateServiceBusManager(string serviceBus, string version, string queueType)
        {
            _mgr = ServiceBusFactory.CreateManager(serviceBus, version, queueType);
              _mgr.ErrorOccured += System_ErrorOccured;
              _mgr.WarningOccured += System_WarningOccured;
              _mgr.ItemsChanged += System_ItemsChanged;

              var cmdSender = ( _mgr as ISendCommand );
              if( cmdSender != null )
            cmdSender.CommandContentFormat = Config.CurrentServer.CommandContentType;

              lock( _itemsLock )
            _items.Clear();

              _mgr.Initialize(Config.CurrentServer.ConnectionSettings, Config.MonitorQueues.Select(mq => new Queue(mq.Name, mq.Type, mq.Color)).ToArray(), _monitorState);

              CanSendCommand = ( _mgr as ISendCommand ) != null;
              CanViewSubscriptions = ( _mgr as IViewSubscriptions ) != null;

              _serviceBusHistory.Add(ServiceBusInfo.Create(serviceBus, version, queueType));
        }
Exemple #18
0
 public TopicSubscription(IServiceBusManager serviceBusManager)
 {
     _serviceBusManager = serviceBusManager;
 }
        private void RestartSystem()
        {
            this.IsEnabled = false;
              lbItems.ItemsSource = null;

              BackgroundWorker w = new BackgroundWorker();
              w.DoWork += (s, e) => {

            try {
              _sys.SwitchServiceBus(_sys.Config.ServiceBus, _sys.Config.ServiceBusVersion, _sys.Config.ServiceBusQueueType);
              _mgr = _sys.Manager;

            } catch( RestartRequiredException ) {
              e.Cancel = true;
            }
              };

              w.RunWorkerCompleted += (s, e) => {
            if( !e.Cancelled ) {
              this.IsEnabled = true;
              RestoreMonitorQueueState();

              btnSendCommand.IsEnabled = _sys.CanSendCommand;
              btnViewSubscriptions.IsEnabled = _sys.CanViewSubscriptions;

              lbItems.ItemsSource = _sys.Items;

              if( !lbItems.IsEnabled )
            lbItems.IsEnabled = true;

              SetupContextMenu();

              UpdateTitle();

              _sys.StartMonitoring();

            } else { // Restart needed

              System.Diagnostics.Process.Start(Application.ResourceAssembly.Location, "-f");
              Application.Current.Shutdown();
            }
              };

              w.RunWorkerAsync();
        }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventAgregator"/> class.
 /// </summary>
 /// <param name="serviceBusManager">The service bus manager.</param>
 public EventAgregator(IServiceBusManager serviceBusManager)
 {
     // Subscribe on events
     this.serviceBusManager = serviceBusManager;
 }