Beispiel #1
0
        private void Initialize(MessageQueueWorkerInfo[] workerInfos,
                                KeyValuePair <string, CreateQueueMessageWrapperHandler>[] createMessageWrappers)
        {
            ModuleProc PROC = new ModuleProc(DYN_MODULE_NAME, "Initialize");

            try
            {
                _uniqueKey = KEY_PREFIX + Guid.NewGuid().ToString();
                this.ExecutorService.AddExecutor(this);
                this.RegisterForShutdown();

                _queueWorkers = new SortedDictionary <string, MessageQueueWorker>(StringComparer.InvariantCultureIgnoreCase);
                foreach (MessageQueueWorkerInfo workerInfo in workerInfos)
                {
                    MessageQueueWorker worker = new MessageQueueWorker(this, this.ExecutorService, _poolType, workerInfo, createMessageWrappers);
                    string             key    = worker.UniqueKey;
                    _queueWorkers.Add(key, worker);

                    if (workerInfo.DependencyWorker != null)
                    {
                        string workerKey = workerInfo.DependencyWorker.WorkerKey;
                        if (_queueWorkers.ContainsKey(workerKey))
                        {
                            worker.DependencyWorker = _queueWorkers[workerKey];
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Beispiel #2
0
 private void AddToDependencyWorker(MessageQueueWorker thisWorker)
 {
     if (_dependencyWorkers == null)
     {
         lock (_dependencyWorkerLock)
         {
             if (_dependencyWorkers == null)
             {
                 _dependencyWorkers = new List <MessageQueueWorker>();
             }
         }
     }
     _hasDependency |= true;
     _dependencyWorkers.Add(thisWorker);
 }