Path: redb-route/redb.Route/Abstractions/IEndpoint.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/Abstractions/IEndpoint.cs
----
using Microsoft.Extensions.DependencyInjection;
namespace redb.Route.Abstractions;
///
/// Represents a lightweight endpoint in the route pipeline.
/// An endpoint is an addressable destination/source identified by a normalized URI key.
/// No metrics or health checks — those are handled by OpenTelemetry infrastructure.
///
public interface IEndpoint
{
/// Parsed URI identifying this endpoint.
EndpointUri Uri { get; }
/// The component that created this endpoint.
IComponent Component { get; }
/// Creates a producer for sending messages to this endpoint.
IProducer CreateProducer();
/// Creates a consumer for receiving messages from this endpoint.
/// The processor to invoke when a message arrives.
IConsumer CreateConsumer(IProcessor processor);
/// Starts the endpoint lifecycle.
/// Cancellation token.
Task Start(CancellationToken ct = default);
/// Stops the endpoint lifecycle.
/// Cancellation token.
Task Stop(CancellationToken ct = default);
///
/// Optional scope factory for creating per-exchange DI scopes.
/// Set by RouteContext during endpoint creation. Null when running without DI.
///
IServiceScopeFactory? ScopeFactory { get => null; set { } }
}