|
1 | | -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic; |
3 | 3 |
|
4 | 4 | namespace Foundatio.Messaging; |
5 | 5 |
|
| 6 | +/// <summary> |
| 7 | +/// Represents a message bus that supports both publishing and subscribing to messages. |
| 8 | +/// </summary> |
6 | 9 | public interface IMessageBus : IMessagePublisher, IMessageSubscriber, IDisposable |
7 | 10 | { |
8 | 11 | } |
9 | 12 |
|
10 | | -public class MessageOptions |
| 13 | +/// <summary> |
| 14 | +/// Options for configuring message publishing behavior. |
| 15 | +/// </summary> |
| 16 | +public record MessageOptions |
11 | 17 | { |
| 18 | + /// <summary> |
| 19 | + /// Gets or sets a unique identifier for the message. |
| 20 | + /// Can be used for message deduplication and idempotency checks. |
| 21 | + /// </summary> |
12 | 22 | public string UniqueId { get; set; } |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Gets or sets the correlation identifier for distributed tracing. |
| 26 | + /// If not set, this is automatically populated from <see cref="System.Diagnostics.Activity.Current"/> |
| 27 | + /// when the message is published, enabling end-to-end request tracing across services. |
| 28 | + /// </summary> |
13 | 29 | public string CorrelationId { get; set; } |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Gets or sets the delay before the message is delivered to subscribers. |
| 33 | + /// <para> |
| 34 | + /// Support for delayed delivery varies by provider. Some providers support native delayed delivery |
| 35 | + /// where messages are persisted and survive application restarts. Other providers use an in-memory |
| 36 | + /// fallback where messages are held in memory until the delay expires. |
| 37 | + /// </para> |
| 38 | + /// <para> |
| 39 | + /// <strong>Warning:</strong> For providers using the in-memory fallback, delayed messages are not persisted |
| 40 | + /// and will be lost if the application restarts before the delay expires. Check your provider's |
| 41 | + /// documentation for specific behavior. |
| 42 | + /// </para> |
| 43 | + /// </summary> |
14 | 44 | public TimeSpan? DeliveryDelay { get; set; } |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Gets or sets custom properties to include with the message. |
| 48 | + /// These properties are propagated through the message bus and available to subscribers. |
| 49 | + /// The mechanism for propagation varies by provider implementation. |
| 50 | + /// </summary> |
15 | 51 | public IDictionary<string, string> Properties { get; set; } = new Dictionary<string, string>(); |
16 | 52 | } |
0 commit comments