Path: redb-route/redb.Route.Exec/ExecComponent.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Exec/ExecComponent.cs
----
using redb.Route.Abstractions;
using redb.Route.Core;
namespace redb.Route.Exec;
///
/// Process-execution component. Scheme: exec.
///
/// Producer: synchronous request/response — runs the configured command and writes
/// the result (stdout/stderr/exit code) to .
///
///
/// Consumer: scheduled poller driven by — fires the command on
/// a fixed interval and pushes the result into the route pipeline.
///
///
/// URI: exec://run?command=git&args=status&timeoutMs=5000&allowedCommands=git,ls
///
///
public sealed class ExecComponent : ComponentBase
{
///
public override string Scheme => "exec";
///
public override IEndpoint CreateEndpoint(EndpointUri uri)
{
ArgumentNullException.ThrowIfNull(uri);
var options = new ExecEndpointOptions();
options.BindFromUri(uri.RawParameters);
options.Validate();
return new ExecEndpoint(uri, this, options);
}
}
///
/// Exec endpoint. Creates either a request/response producer or a scheduled consumer.
/// The host part of the URI (exec://run) is informational and not interpreted —
/// the actual command target comes from or
/// the inbound exchange.
///
public sealed class ExecEndpoint : EndpointBase
{
/// Creates an exec endpoint.
public ExecEndpoint(EndpointUri uri, ExecComponent component, ExecEndpointOptions options)
: base(uri, component, options)
{
}
/// Endpoint options for external access.
internal ExecEndpointOptions EndpointOptions => Options;
///
public override IProducer CreateProducer() => new ExecProducer(this, Options);
///
public override IConsumer CreateConsumer(IProcessor processor)
{
ArgumentNullException.ThrowIfNull(processor);
return new ExecConsumer(this, Options, processor);
}
}