public RetrievedItemsCleanerManager ( WorkItemSlotCollection retrievedItems, bool retrievalQueueRecoverable, ContextIdentifier contextIdentifier, int retrievedItemsCleanerInterval, string name, string description, int cleanersCount, int cleanerRegularStopTimeout ) : base ( name, description ) { _retrievedItems = retrievedItems; _retrievalQueueRecoverable = retrievalQueueRecoverable; _contextIdentifier = contextIdentifier; _retrievedItemsCleanerInterval = retrievedItemsCleanerInterval; this.cleanersCount = cleanersCount; this.cleanerRegularStopTimeout = cleanerRegularStopTimeout; }
public override WorkItem GetNextWorkItem ( WorkItemSlotCollection slots ) { workItemCandidate = null; #region Process if (ReservePrioritySlot(PriorityScope)) { if (ExecutionState != ProcessExecutionState.Running) { return null; } try { WorkItem workItem = GetWorkItemFromQueue (); if (workItem != null) { Log.Source.TraceData(TraceEventType.Verbose, ProducerMessage.MessageRetrieved, new ContextualLogEntry { Message = "Got a new work item" + workItem, ContextIdentifier = new ContextIdentifier() }); return workItem; } } catch (Exception ex) { // Interrupt should not be a problem CancelPrioritySlotReservation(PriorityScope); Log.Source.TraceData(TraceEventType.Error, ProducerMessage.RetrieveMessageFailed, new ContextualLogEntry { Message = "Error during getting work item." + ex, ContextIdentifier = new ContextIdentifier() }); return null; } CancelPrioritySlotReservation(PriorityScope); } #endregion Process return null; }
public ProcessingStateData ( WorkItemSlotsConfiguration configuration ) { _retrievedItems = WorkItemSlotCollection.Create(configuration); _submittedItems = new WorkItemCollection(); }
public RetrievedItemsCleaner (WorkItemSlotCollection retrievedItems, ContextIdentifier contextIdentifier, int retrievedItemsCleanerInterval, int cleanerRegularStopTimeout, string name, string description) : base ( name, description ) { _retrievedItems = retrievedItems; _contextIdentifier = contextIdentifier; _retrievedItemsCleanerInterval = retrievedItemsCleanerInterval; this.cleanerRegularStopTimeout = cleanerRegularStopTimeout; }
/// <summary> /// <para> /// Initializes a new instance of <see cref='WorkItemSlotCollection'/>. /// </para> /// </summary> // public WorkItemSlotCollection() // { // indexes = new PrioritySlotsIndexCollection(); // } /// <summary> /// <para> /// Initializes a new instance of <see cref='WorkItemSlotCollection'/>. /// </para> /// </summary> public WorkItemSlotCollection(WorkItemSlotCollection value) { AddRange(value); }
/// <summary> /// <para> /// Adds the contents of another <see cref='WorkItemSlotCollection'/> to the end of the collection. /// </para> /// </summary> /// <param name='value'> /// A <see cref='WorkItemSlotCollection'/> containing the objects to add to the collection. /// </param> /// <returns> /// <para>None.</para> /// </returns> /// <seealso cref='WorkItemSlotCollection.Add'/> public void AddRange(WorkItemSlotCollection value) { for (int i = 0; (i < value.Count); i = (i + 1)) { Add(value[i]); } }
public override WorkItem GetNextWorkItem(WorkItemSlotCollection slots) { //TODO: This will be working on one thread only so skipping the synchronization here Trace.CorrelationManager.ActivityId = Guid.NewGuid(); try { queue.Open(); } catch (Exception ex) { if (!queue.RecoverFromConnectionError(ex)) { Stop(); } return null; } workItemCandidate = null; #region Process if (ReservePrioritySlot(PriorityScope)) { if (ExecutionState != ProcessExecutionState.Running) { return null; } try { WorkItem workItem = GetWorkItemFromQueue(PriorityScope); if (workItem != null) { //Log.TraceData(Log.Source, System.Diagnostics.TraceEventType.Verbose, // ProducerMessage.MessageRetrieved, // new ContextualLogEntry // { // Message = "Got a new work item" + workItem, // ContextIdentifier = new ContextIdentifier() // }); return workItem; } } catch (Exception ex) { // Interrupt should not be a problem CancelPrioritySlotReservation(PriorityScope); Log.TraceData(Log.Source, System.Diagnostics.TraceEventType.Error, ProducerMessage.RetrieveMessageFailed, new ContextualLogEntry { Message = "Error during getting work item." + ex, ContextIdentifier = new ContextIdentifier() }); return null; } CancelPrioritySlotReservation(PriorityScope); } #endregion Process return null; }
public abstract WorkItem GetNextWorkItem(WorkItemSlotCollection slots);
public override WorkItem GetNextWorkItem(WorkItemSlotCollection slots) { return null; }