예제 #1
0
        /// <summary>
        /// CTOR.
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="logger"></param>
        private Conveyor(ConveyorRunSettings settings, Logger logger = null)
        {
            mSettings = settings;
            mLogger   = logger;

            mWaitThread = new Thread(SetTrigger)
            {
                IsBackground = true
            };
            mWaitThread.Start();
            mCountersHarvestThread = new Thread(HarvestCounters)
            {
                IsBackground = true
            };
            mCountersHarvestThread.Start();

            try
            {
                mQueueManager = Injection.InjectionProvider.Get <QueuesManagerContract>();
            }
            catch (Exception e)
            {
                mLogger?.Warn(
                    $"No any queue managers registered by contract QueueManagerContract: {e}. Default InMemoryQueueManager will be loaded.");
                mQueueManager = new InMemoryQueueManager();
            }

            Injection.InjectionProvider.RegisterSingle <ConveyorContract>(this);
        }
예제 #2
0
 /// <summary>
 /// Initialize instance of conveyor.
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 public static Conveyor Init(Logger logger = null,
                             ConveyorRunSettings settings = null)
 {
     if (Instance != null)
     {
         throw new ConveyorInstanceAlreadyInitializer();
     }
     Instance = new Conveyor(settings ?? ConveyorRunSettings.Default, logger);
     return(Instance);
 }