Skip to content

Class EventTopicAttribute

Namespace: Momentum.Extensions.Abstractions.Messaging
Assembly: Momentum.Extensions.Abstractions.dll

Specifies the topic name for a distributed event class.

csharp
[AttributeUsage(AttributeTargets.Class)]
public class EventTopicAttribute : Attribute

Inheritance

objectAttributeEventTopicAttribute

Derived

EventTopicAttribute<TEntity>

Inherited Members

Attribute.GetCustomAttributes(MemberInfo, Type), Attribute.GetCustomAttributes(MemberInfo, Type, bool), Attribute.GetCustomAttributes(MemberInfo), Attribute.GetCustomAttributes(MemberInfo, bool), Attribute.IsDefined(MemberInfo, Type), Attribute.IsDefined(MemberInfo, Type, bool), Attribute.GetCustomAttribute(MemberInfo, Type), Attribute.GetCustomAttribute(MemberInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo), Attribute.GetCustomAttributes(ParameterInfo, Type), Attribute.GetCustomAttributes(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(ParameterInfo, bool), Attribute.IsDefined(ParameterInfo, Type), Attribute.IsDefined(ParameterInfo, Type, bool), Attribute.GetCustomAttribute(ParameterInfo, Type), Attribute.GetCustomAttribute(ParameterInfo, Type, bool), Attribute.GetCustomAttributes(Module, Type), Attribute.GetCustomAttributes(Module), Attribute.GetCustomAttributes(Module, bool), Attribute.GetCustomAttributes(Module, Type, bool), Attribute.IsDefined(Module, Type), Attribute.IsDefined(Module, Type, bool), Attribute.GetCustomAttribute(Module, Type), Attribute.GetCustomAttribute(Module, Type, bool), Attribute.GetCustomAttributes(Assembly, Type), Attribute.GetCustomAttributes(Assembly, Type, bool), Attribute.GetCustomAttributes(Assembly), Attribute.GetCustomAttributes(Assembly, bool), Attribute.IsDefined(Assembly, Type), Attribute.IsDefined(Assembly, Type, bool), Attribute.GetCustomAttribute(Assembly, Type), Attribute.GetCustomAttribute(Assembly, Type, bool), Attribute.Equals(object?), Attribute.GetHashCode(), Attribute.Match(object?), Attribute.IsDefaultAttribute(), Attribute.TypeId, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

[EventTopic("user-created", domain: "users")]
public class UserCreatedEvent : IDistributedEvent { }

Remarks

Apply this attribute to distributed event classes to define their topic name in the message broker. The topic name is used for routing messages to the appropriate consumers. An optional domain can be specified to override the assembly's default domain.

Constructors

EventTopicAttribute(string, string?, string)

Specifies the topic name for a distributed event class.

csharp
public EventTopicAttribute(string topic, string? domain = null, string version = "v1")

Parameters

topic string

domain string?

version string

Examples

[EventTopic("user-created", domain: "users")]
public class UserCreatedEvent : IDistributedEvent { }

Remarks

Apply this attribute to distributed event classes to define their topic name in the message broker. The topic name is used for routing messages to the appropriate consumers. An optional domain can be specified to override the assembly's default domain.

Properties

Domain

Domain for the event.

csharp
public string? Domain { get; }

Property Value

string?

Internal

Indicates if the event is internal or public (Default: public)

csharp
public bool Internal { get; set; }

Property Value

bool

ShouldPluralizeTopicName

csharp
public virtual bool ShouldPluralizeTopicName { get; }

Property Value

bool

Topic

Topic name for the event.

csharp
public string Topic { get; }

Property Value

string

Version

Event major version (Default: 'v1')

csharp
public string Version { get; }

Property Value

string