ServiceBusMQ.SbmqSystem.Initialize C# (CSharp) Method

Initialize() private method

private Initialize ( ) : void
return void
    private void Initialize() {
      AppDomain.CurrentDomain.AssemblyResolve += SbmqmDomain_AssemblyResolve;
      _monitorState = new SbmqmMonitorState();

      Config = SystemConfig.Load();

      Config.StartCount += 1;
      Config.Save();

      // Check if we still have the ServiceBus Adapter available
      var availMgrs = ServiceBusFactory.AvailableServiceBusManagers();
      if( !availMgrs.Any(mgr => mgr.Name == Config.ServiceBus && mgr.Version == Config.ServiceBusVersion && mgr.QueueType == Config.ServiceBusQueueType) ) {

        // Check if we have any other versions available
        var m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus && mgr.QueueType == Config.ServiceBusQueueType);

        if( m != null )
          Config.CurrentServer.ServiceBusVersion = m.Version;

        else { // Check if we have this ServiceBus Type
          m = availMgrs.FirstOrDefault(mgr => mgr.Name == Config.ServiceBus);

          if( m != null ) {
            Config.CurrentServer.ServiceBusQueueType = m.QueueType;
            Config.CurrentServer.ServiceBusVersion = m.Version;
          } else throw new NotSupportedException("Not Supported Service Bus type '{0}', Please re-install Service Bus MQ Manager.".With(Config.ServiceBus));


        }


      }

      CreateServiceBusManager(Config.ServiceBus, Config.ServiceBusVersion, Config.ServiceBusQueueType);


      _history = new CommandHistoryManager(Config);

      AppInfo = new ApplicationInfo(Config.Id, Assembly.GetEntryAssembly());
    }

Usage Example

Ejemplo n.º 1
0
        public static SbmqSystem Create()
        {
            _instance = new SbmqSystem();
            _instance.Initialize();

            return(_instance);
        }
All Usage Examples Of ServiceBusMQ.SbmqSystem::Initialize