ChannelProgressReporter
NexusLabs.Needlr.AgentFramework¶
NexusLabs.Needlr.AgentFramework.Progress¶
ChannelProgressReporter Class¶
Non-blocking IProgressReporter that pushes events to a System.Threading.Channels.Channel<> and drains them to sinks on a background task. Use this when sinks do I/O (database, network) and you don't want to block the agent pipeline.
public sealed class ChannelProgressReporter : NexusLabs.Needlr.AgentFramework.Progress.IProgressReporter, System.IAsyncDisposable
Inheritance System.Object 🡒 ChannelProgressReporter
Implements IProgressReporter, System.IAsyncDisposable
Remarks¶
Report(IProgressEvent) writes to the channel and returns immediately. A background consumer drains events to all sinks. Events are delivered in order but asynchronously.
CreateChild(string) returns a lightweight wrapper that shares the parent's channel — no additional background tasks are created.
Call DisposeAsync() to drain remaining events and stop the background consumer.
Constructors¶
ChannelProgressReporter(string, IReadOnlyList<IProgressSink>, IProgressSequence, IProgressReporterErrorHandler, string, string, int, int) Constructor¶
Creates a channel-based reporter with the given sinks. Starts a background consumer immediately.
public ChannelProgressReporter(string workflowId, System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.AgentFramework.Progress.IProgressSink> sinks, NexusLabs.Needlr.AgentFramework.Progress.IProgressSequence sequence, NexusLabs.Needlr.AgentFramework.Progress.IProgressReporterErrorHandler? errorHandler=null, string? agentId=null, string? parentAgentId=null, int depth=0, int capacity=1000);
Parameters¶
workflowId System.String
sinks System.Collections.Generic.IReadOnlyList<IProgressSink>
sequence IProgressSequence
errorHandler IProgressReporterErrorHandler
agentId System.String
parentAgentId System.String
depth System.Int32
capacity System.Int32
Properties¶
ChannelProgressReporter.AgentId Property¶
Gets the current agent ID, or null for workflow-level scope.
Implements AgentId
Property Value¶
ChannelProgressReporter.Depth Property¶
Gets the nesting depth.
Implements Depth
Property Value¶
ChannelProgressReporter.WorkflowId Property¶
Gets the workflow ID for this reporter's scope.
Implements WorkflowId
Property Value¶
Methods¶
ChannelProgressReporter.CreateChild(string) Method¶
Creates a child reporter scoped to a specific agent. Events emitted by the child
carry the parent's agent ID as ParentAgentId and an incremented Depth.
Parameters¶
agentId System.String
The agent ID for the child scope.
Implements CreateChild(string)
Returns¶
ChannelProgressReporter.DisposeAsync() Method¶
Completes the channel and waits for the background consumer to drain all remaining events to sinks.
Implements DisposeAsync()
Returns¶
System.Threading.Tasks.ValueTask
ChannelProgressReporter.NextSequence() Method¶
Allocates the next globally-ordered sequence number.
Implements NextSequence()
Returns¶
ChannelProgressReporter.Report(IProgressEvent) Method¶
Emits a progress event to all registered sinks.
Parameters¶
progressEvent IProgressEvent
Implements Report(IProgressEvent)