Path: redb-route/redb.Route/Core/EndpointRoleAttribute.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/Core/EndpointRoleAttribute.cs
----
namespace redb.Route.Core;
/// The side of an endpoint that reads an option, or the only side a component has.
public enum EndpointRole
{
/// Read only by the consumer (from(...)).
Consumer,
/// Read only by the producer (to(...)).
Producer,
}
///
/// Declares that only one side of an endpoint reads this option — Camel's @UriParam(label = "consumer") /
/// label = "producer". An options class shared by producer and consumer otherwise gives no sign that an option
/// written on the other side does nothing: username on an http: consumer looked like protection and checked
/// nobody. The connector refuses such an option by this declaration
/// (), and tooling — the Route-XML catalog, the editor schema,
/// check — reads the same declaration by reflection. An option both sides read carries no role.
///
/// On a component class it declares the only side the component has: Apache Camel's producerOnly /
/// consumerOnly. [EndpointRole(EndpointRole.Producer)] on smtp means a route cannot start from it;
/// the context refuses such a route, and the catalog, the editor schema and check read the same declaration
/// (). A component with both sides carries none.
///
///
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public sealed class EndpointRoleAttribute(EndpointRole role) : Attribute
{
/// The side that reads the option, or the only side of the component.
public EndpointRole Role { get; } = role;
///
/// On a component: what to use instead, appended to the refusal of the missing side
/// ("Use imap: or pop3: to receive mail."). Not read on an option.
///
public string? Hint { get; init; }
}