Table of Contents

Class IntegrationEventNameAttribute

Namespace
Trellis
Assembly
Trellis.Core.dll

Declares the stable, on-the-wire name of an IIntegrationEvent so producers and consumers in different services can agree on the type a message carries.

[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class IntegrationEventNameAttribute : Attribute
Inheritance
IntegrationEventNameAttribute
Inherited Members
Extension Methods

Examples

[IntegrationEventName("orders.order-placed.v1")]
public sealed record OrderPlaced(Guid OrderId, DateTimeOffset OccurredAt) : IIntegrationEvent;

Remarks

Why a logical name is required across services. In-process relaying identifies an event by its AssemblyQualifiedName, which is fine while producer and consumer are the same process. On a message broker it is unusable: the consumer's assemblies differ from the producer's, and the string embeds an assembly version, so it can stop resolving after a routine version bump. A logical name is owned by the contract rather than by the CLR layout, so each side maps it to whatever local type it likes.

Choose a versioned name. The name is a published contract: once a message carrying it exists on a queue or in another team's code, changing it is a breaking change. Include a version segment (orders.order-placed.v1) so an incompatible payload change can ship as a new name consumed side-by-side, rather than as a silent break.

Names are compared with the ordinal comparer — casing is significant.

Constructors

IntegrationEventNameAttribute(string)

Declares the stable, on-the-wire name of an IIntegrationEvent so producers and consumers in different services can agree on the type a message carries.

public IntegrationEventNameAttribute(string name)

Parameters

name string

The stable wire name, for example orders.order-placed.v1.

Examples

[IntegrationEventName("orders.order-placed.v1")]
public sealed record OrderPlaced(Guid OrderId, DateTimeOffset OccurredAt) : IIntegrationEvent;

Remarks

Why a logical name is required across services. In-process relaying identifies an event by its AssemblyQualifiedName, which is fine while producer and consumer are the same process. On a message broker it is unusable: the consumer's assemblies differ from the producer's, and the string embeds an assembly version, so it can stop resolving after a routine version bump. A logical name is owned by the contract rather than by the CLR layout, so each side maps it to whatever local type it likes.

Choose a versioned name. The name is a published contract: once a message carrying it exists on a queue or in another team's code, changing it is a breaking change. Include a version segment (orders.order-placed.v1) so an incompatible payload change can ship as a new name consumed side-by-side, rather than as a silent break.

Names are compared with the ordinal comparer — casing is significant.

Properties

Name

The stable wire name identifying this event's contract.

public string Name { get; }

Property Value

string