Esempio n. 1
0
        internal TaskOrchestrationDispatcher(MessagingFactory messagingFactory,
                                             TrackingDispatcher trackingDispatcher,
                                             TaskHubDescription taskHubDescription,
                                             TaskHubWorkerSettings workerSettings,
                                             string orchestratorEntityName,
                                             string workerEntityName,
                                             string trackingEntityName,
                                             NameVersionObjectManager <TaskOrchestration> objectManager)
            : base("TaskOrchestration Dispatcher", item => item.Session == null ? string.Empty : item.Session.SessionId)
        {
            this.taskHubDescription = taskHubDescription;
            settings = workerSettings.Clone();
            this.orchestratorEntityName         = orchestratorEntityName;
            this.workerEntityName               = workerEntityName;
            this.trackingEntityName             = trackingEntityName;
            this.messagingFactory               = messagingFactory;
            this.messagingFactory.PrefetchCount = PrefetchCount;
            this.objectManager      = objectManager;
            orchestratorQueueClient = this.messagingFactory.CreateQueueClient(this.orchestratorEntityName);
            workerSender            = this.messagingFactory.CreateMessageSender(this.workerEntityName, this.orchestratorEntityName);

            trackingDipatcher = trackingDispatcher;
            if (trackingDipatcher != null)
            {
                isTrackingEnabled = true;
                trackingSender    = this.messagingFactory.CreateMessageSender(this.trackingEntityName,
                                                                              this.orchestratorEntityName);
            }
            maxConcurrentWorkItems = settings.TaskOrchestrationDispatcherSettings.MaxConcurrentOrchestrations;
        }
Esempio n. 2
0
        /// <summary>
        ///     Create a new TaskHubWorker with given name, Service Bus and Azure Storage connection string
        /// </summary>
        /// <param name="hubName">Name of the Task Hub</param>
        /// <param name="connectionString">Service Bus connection string</param>
        /// <param name="tableStoreConnectionString">Azure Storage connection string</param>
        /// <param name="workerSettings">Settings for various task hub worker options</param>
        public TaskHubWorker(string hubName, string connectionString, string tableStoreConnectionString,
                             TaskHubWorkerSettings workerSettings)
        {
            if (string.IsNullOrEmpty(hubName))
            {
                throw new ArgumentException("hubName");
            }

            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentException("connectionString");
            }

            if (workerSettings == null)
            {
                throw new ArgumentException("workerSettings");
            }

            this.hubName                    = hubName.ToLower();
            this.connectionString           = connectionString;
            workerEntityName                = string.Format(FrameworkConstants.WorkerEndpointFormat, this.hubName);
            orchestratorEntityName          = string.Format(FrameworkConstants.OrchestratorEndpointFormat, this.hubName);
            trackingEntityName              = string.Format(FrameworkConstants.TrackingEndpointFormat, this.hubName);
            orchestrationManager            = new NameVersionObjectManager <TaskOrchestration>();
            activityManager                 = new NameVersionObjectManager <TaskActivity>();
            this.tableStoreConnectionString = tableStoreConnectionString;
            this.workerSettings             = workerSettings;
        }
 internal TaskActivityDispatcher(MessagingFactory messagingFactory,
                                 TaskHubDescription taskHubDescription,
                                 TaskHubWorkerSettings workerSettings,
                                 string orchestratorQueueName,
                                 string workerQueueName,
                                 NameVersionObjectManager <TaskActivity> objectManager)
     : base("TaskActivityDispatcher", item => item.MessageId)
 {
     this.taskHubDescription = taskHubDescription;
     settings = workerSettings.Clone();
     this.orchestratorQueueName = orchestratorQueueName;
     this.workerQueueName       = workerQueueName;
     this.messagingFactory      = messagingFactory;
     this.objectManager         = objectManager;
     maxConcurrentWorkItems     = settings.TaskActivityDispatcherSettings.MaxConcurrentActivities;
 }