Class ProcessingPayloadsRegistry<T>
- Namespace
- FoundationaLLM.DataPipelineEngine.Services.Queueing
- Assembly
- FoundationaLLM.DataPipelineEngine.dll
Maintains a registry of payloads that are currently being processed.
public class ProcessingPayloadsRegistry<T>
Type Parameters
T
- Inheritance
-
ProcessingPayloadsRegistry<T>
- Inherited Members
- Extension Methods
Constructors
ProcessingPayloadsRegistry(IMessageQueueService<T>, ILogger)
Maintains a registry of payloads that are currently being processed.
public ProcessingPayloadsRegistry(IMessageQueueService<T> messageQueueService, ILogger logger)
Parameters
messageQueueService
IMessageQueueService<T>The message queue service providing queueing capabilities.
logger
ILoggerThe logger used for logging.
Methods
ExtendPayloadsProcessingTime(IEnumerable<string>, bool)
Extends the processing time for the specified payloads.
public Task ExtendPayloadsProcessingTime(IEnumerable<string> payloadIds, bool recoverFromError = false)
Parameters
payloadIds
IEnumerable<string>The list of payload identifiers for which processing time is extended.
recoverFromError
boolIndicates whether the extension is required to attempt to recover from an error.
Returns
Remarks
This operation ensures that the specified payloads can continue to be processed without running the risk of being dequeued due to timeout and generating a processing race condition.
IgnorePayloads(IEnumerable<string>)
Ignores a list of payloads.
public Task IgnorePayloads(IEnumerable<string> payloadIds)
Parameters
payloadIds
IEnumerable<string>The list of payload identifiers to ignore.
Returns
NewPayloadsAvailable()
Indicates whether there are new payloads available for processing.
public Task<bool> NewPayloadsAvailable()
Returns
ReceivePayloadsForProcessing(int, Func<T, string>)
Receives a specified number of payloads for processing.
public Task<IEnumerable<T>> ReceivePayloadsForProcessing(int payloadsCount, Func<T, string> idSelector)
Parameters
payloadsCount
intThe maximum number of payloads to receive.
idSelector
Func<T, string>The identifier selector for a payload.
Returns
- Task<IEnumerable<T>>
A list containing the received payloads.
RemovePayload(string, bool)
Removes a payload.
public Task RemovePayload(string payloadId, bool deleteMessage = true)
Parameters
payloadId
stringThe identifier of the payload to remove.
deleteMessage
boolIndicates whether the underlying message should be deleted as well.