using System; namespace Tapeti.Annotations { /// /// /// Can be attached to a message class to override or extend the generated routing key. /// One of the intended scenarios is for versioning messages, where you want to add for example a /// ".v2" postfix but keep the class name itself the same (in a different namespace of course). /// /// /// The implementation of IRoutingKeyStrategy must explicitly add support for this attribute for it to have effect. /// The default implementation (TypeNameRoutingKeyStrategy) does, of course. Custom implementations can use /// the Tapeti.Helpers.RoutingKeyHelper class to add support and keep up-to-date automatically. /// /// When using EnableDeclareDurableQueues to automatically generate the queue bindings, both the sender and receiver must /// use a Tapeti version >= 2.5 to support this attribute or the binding will differ from the sent routing key. /// /// The routing keys are no longer used by Tapeti once the message is in the queue, the message handler /// is instead based on the full message class name (thus including namespace), so if the binding is generated in any /// other way this remark does not apply and prior versions of Tapeti are compatible. /// [AttributeUsage(AttributeTargets.Class)] public class RoutingKeyAttribute : Attribute { /// /// If specified, the routing key strategy is skipped altogether and this value is used instead. /// /// /// The Prefix and Postfix properties will not have any effect if the Full property is specified. /// public string Full { get; set; } /// /// If specified, the value generated by the default routing key strategy is prefixed with this value. /// No dot will be added after this prefix, if you want to include it add it as part of the value. /// /// /// This property will not have any effect if the Full property is specified. Can be used in combination with Postfix. /// public string Prefix { get; set; } /// /// If specified, the value generated by the default routing key strategy is postfixed with this value. /// No dot will be added before this postfix, if you want to include it add it as part of the value. /// /// /// This property will not have any effect if the Full property is specified. Can be used in combination with Prefix. /// public string Postfix { get; set; } } }