Class EventTopicAttribute
Namespace: Momentum.Extensions.Abstractions.Messaging
Assembly: Momentum.Extensions.Abstractions.dll
Specifies the topic name for a distributed event class.
[AttributeUsage(AttributeTargets.Class)]
public class EventTopicAttribute : Attribute
Inheritance
object ← Attribute ← EventTopicAttribute
Derived
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.
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.
public string? Domain { get; }
Property Value
Internal
Indicates if the event is internal or public (Default: public)
public bool Internal { get; set; }
Property Value
ShouldPluralizeTopicName
public virtual bool ShouldPluralizeTopicName { get; }
Property Value
Topic
Topic name for the event.
public string Topic { get; }
Property Value
Version
Event major version (Default: 'v1')
public string Version { get; }