Ejemplo n.º 1
0
 public Partition(
     NetheriteOrchestrationService host,
     uint partitionId,
     Func <string, uint> partitionFunction,
     Func <uint> numberPartitions,
     TransportAbstraction.ISender batchSender,
     NetheriteOrchestrationServiceSettings settings,
     string storageAccountName,
     WorkItemQueue <ActivityWorkItem> activityWorkItemQueue,
     WorkItemQueue <OrchestrationWorkItem> orchestrationWorkItemQueue,
     LoadPublisher loadPublisher,
     WorkItemTraceHelper workItemTraceHelper)
 {
     this.host                       = host;
     this.PartitionId                = partitionId;
     this.PartitionFunction          = partitionFunction;
     this.NumberPartitions           = numberPartitions;
     this.BatchSender                = batchSender;
     this.Settings                   = settings;
     this.StorageAccountName         = storageAccountName;
     this.ActivityWorkItemQueue      = activityWorkItemQueue;
     this.OrchestrationWorkItemQueue = orchestrationWorkItemQueue;
     this.LoadPublisher              = loadPublisher;
     this.TraceHelper                = new PartitionTraceHelper(host.Logger, settings.LogLevelLimit, this.StorageAccountName, this.Settings.HubName, this.PartitionId);
     this.EventTraceHelper           = new EventTraceHelper(host.LoggerFactory, settings.EventLogLevelLimit, this);
     this.WorkItemTraceHelper        = workItemTraceHelper;
     this.stopwatch.Start();
 }
Ejemplo n.º 2
0
        public Client(
            NetheriteOrchestrationService host,
            Guid clientId,
            Guid taskHubGuid,
            TransportAbstraction.ISender batchSender,
            WorkItemTraceHelper workItemTraceHelper,
            CancellationToken shutdownToken)
        {
            this.host                = host;
            this.ClientId            = clientId;
            this.taskHubGuid         = taskHubGuid;
            this.traceHelper         = new ClientTraceHelper(host.Logger, host.Settings.LogLevelLimit, host.StorageAccountName, host.Settings.HubName, this.ClientId);
            this.workItemTraceHelper = workItemTraceHelper;
            this.account             = host.StorageAccountName;
            this.BatchSender         = batchSender;
            this.shutdownToken       = shutdownToken;
            this.ResponseTimeouts    = new BatchTimer <PendingRequest>(this.shutdownToken, this.Timeout, this.traceHelper.TraceTimerProgress);
            this.ResponseWaiters     = new ConcurrentDictionary <long, PendingRequest>();
            this.Fragments           = new Dictionary <string, MemoryStream>();
            this.ResponseTimeouts.Start("ClientTimer");
            this.workItemStopwatch = new Stopwatch();
            this.workItemStopwatch.Start();

            this.traceHelper.TraceProgress("Started");
        }
Ejemplo n.º 3
0
        public void EnqueueOrchestrationWorkItem(OrchestrationWorkItem item)
        {
            this.WorkItemTraceHelper.TraceWorkItemQueued(
                this.PartitionId,
                WorkItemTraceHelper.WorkItemType.Orchestration,
                item.MessageBatch.WorkItemId,
                item.InstanceId,
                item.Type.ToString(),
                WorkItemTraceHelper.FormatMessageIdList(item.MessageBatch.TracedMessages));

            this.OrchestrationWorkItemQueue.Add(item);
        }
Ejemplo n.º 4
0
        public void EnqueueActivityWorkItem(ActivityWorkItem item)
        {
            this.Assert(!string.IsNullOrEmpty(item.OriginWorkItem));

            this.WorkItemTraceHelper.TraceWorkItemQueued(
                this.PartitionId,
                WorkItemTraceHelper.WorkItemType.Activity,
                item.WorkItemId,
                item.TaskMessage.OrchestrationInstance.InstanceId,
                item.ExecutionType,
                WorkItemTraceHelper.FormatMessageId(item.TaskMessage, item.OriginWorkItem));

            this.ActivityWorkItemQueue.Add(item);
        }