@@ -33,7 +33,7 @@ public interface IConsumerBuilder
3333 /// (e.g. after a disconnection).
3434 /// </summary>
3535 /// <param name="listenerContext"> Contains the listenerContext, see <see cref="ListenerContext"/> </param>
36- /// <returns></returns>
36+ /// <returns><see cref="IConsumerBuilder"/>The consumer builder.< /returns>
3737 IConsumerBuilder SubscriptionListener ( Action < ListenerContext > listenerContext ) ;
3838
3939 IStreamOptions Stream ( ) ;
@@ -42,20 +42,179 @@ public interface IConsumerBuilder
4242
4343 public interface IStreamOptions
4444 {
45+ /// <summary>The offset from which to start consuming.</summary>
46+ /// <param name="offset">the offset</param>
47+ /// <returns><see cref="IStreamOptions"/></returns>
4548 IStreamOptions Offset ( long offset ) ;
49+
50+ /// <summary>
51+ /// <para>A point in time from which to start consuming.</para>
52+ /// <para>Be aware consumers can receive messages published a bit before the specified timestamp.</para>
53+ /// </summary>
54+ /// <param name="timestamp">the timestamp</param>
55+ /// <returns><see cref="IStreamOptions"/></returns>
56+ IStreamOptions Offset ( DateTime timestamp ) ;
57+
58+ /// <summary>The offset from which to start consuming.</summary>
59+ /// <param name="specification">the offset specification</param>
60+ /// <returns><see cref="IStreamOptions"/></returns>
61+ /// <see cref="StreamOffsetSpecification"/>
4662 IStreamOptions Offset ( StreamOffsetSpecification specification ) ;
47- IStreamOptions FilterValues ( string [ ] values ) ;
63+
64+ /// <summary>
65+ /// <para>The offset from which to start consuming as an interval string value.</para>
66+ /// <para>Valid units are Y, M, D, h, m, s. Examples: <code>7D</code> (7 days), <code>12h</code> (12 hours).</para>
67+ /// </summary>
68+ /// <param name="interval">the interval</param>
69+ /// <returns><see cref="IStreamOptions"/></returns>
70+ /// <see href="https://www.rabbitmq.com/docs/streams#retention">Interval Syntax</see>
71+ IStreamOptions Offset ( string interval ) ;
72+
73+ /// <summary>
74+ /// <para>Filter values for stream filtering.</para>
75+ /// <para>This a different filtering mechanism from AMQP filter expressions. Both mechanisms can be used together.</para>
76+ /// </summary>
77+ /// <param name="values">filter values</param>
78+ /// <returns><see cref="IStreamOptions"/></returns>
79+ /// <see href="https://www.rabbitmq.com/docs/streams#filtering">Stream Filtering</see>
80+ /// <see cref="Filter"/>
81+ IStreamOptions FilterValues ( params string [ ] values ) ;
82+
83+ /// <summary>
84+ /// <para>Whether messages without a filter value should be sent.</para>
85+ /// <para>Default is <code>false</code> (messages without a filter value are not sent).</para>
86+ /// <para>This a different filtering mechanism from AMQP filter expressions. Both mechanisms can be used together.</para>
87+ /// </summary>
88+ /// <param name="matchUnfiltered"><c>true </c>to send messages without a filter value</param>
89+ /// <returns><see cref="IStreamOptions"/></returns>
90+ /// @see #filter()
91+ /// <see cref="Filter"/>
4892 IStreamOptions FilterMatchUnfiltered ( bool matchUnfiltered ) ;
93+
94+ /// <summary>
95+ /// <para>Options for AMQP filter expressions.</para>
96+ /// <para>Requires RabbitMQ 4.1 or more.</para>
97+ /// <para>This a different filtering mechanism from stream filtering. Both mechanisms can be used together.</para>
98+ /// </summary>
99+ /// <returns><see cref="IStreamFilterOptions"/></returns>
100+ /// <see cref="FilterValues"/>
101+ /// <see cref="FilterMatchUnfiltered(bool)"/>
102+ IStreamFilterOptions Filter ( ) ;
103+
104+ /// <summary>
105+ /// Return the consumer builder.
106+ /// </summary>
107+ /// <returns><see cref="IConsumerBuilder"/></returns>
49108 IConsumerBuilder Builder ( ) ;
50109 }
51110
111+ /// <summary>
112+ /// <para>Filter options for support of AMQP filter expressions.</para>
113+ /// <para>AMQP filter expressions are supported only with streams. This a different filtering mechanism from stream filtering.
114+ /// Both mechanisms can be used together.
115+ /// Requires RabbitMQ 4.1 or more.</para>
116+ /// </summary>
117+ /// <see href="https://groups.oasis-open.org/higherlogic/ws/public/document?document_id=66227">AMQP Filter Expressions</see>
118+ public interface IStreamFilterOptions
119+ {
120+ /// <summary>Filter on message ID.</summary>
121+ /// <param name="id">message ID</param>
122+ /// <returns><see cref="IStreamFilterOptions"/></returns>
123+ IStreamFilterOptions MessageId ( object id ) ;
124+
125+ /// <summary>Filter on user ID.</summary>
126+ /// <param name="userId">correlation ID</param>
127+ /// <returns><see cref="IStreamFilterOptions"/></returns>
128+ IStreamFilterOptions UserId ( byte [ ] userId ) ;
129+
130+ /// <summary>Filter on to field.</summary>
131+ /// <param name="to">correlation ID</param>
132+ /// <returns><see cref="IStreamFilterOptions"/></returns>
133+ IStreamFilterOptions To ( string to ) ;
134+
135+ /// <summary>Filter on subject field.</summary>
136+ /// <param name="subject">correlation ID</param>
137+ /// <returns><see cref="IStreamFilterOptions"/></returns>
138+ IStreamFilterOptions Subject ( string subject ) ;
139+
140+ /// <summary>Filter on reply-to field.</summary>
141+ /// <param name="replyTo">correlation ID</param>
142+ /// <returns><see cref="IStreamFilterOptions"/></returns>
143+ IStreamFilterOptions ReplyTo ( string replyTo ) ;
144+
145+ /// <summary>Filter on correlation ID.</summary>
146+ /// <param name="correlationId">correlation ID</param>
147+ /// <returns><see cref="IStreamFilterOptions"/></returns>
148+ IStreamFilterOptions CorrelationId ( object correlationId ) ;
149+
150+ /// <summary>Filter on content-type field.</summary>
151+ /// <param name="contentType">correlation ID</param>
152+ /// <returns><see cref="IStreamFilterOptions"/></returns>
153+ IStreamFilterOptions ContentType ( string contentType ) ;
154+
155+ /// <summary>Filter on content-encoding field.</summary>
156+ /// <param name="contentEncoding">correlation ID</param>
157+ /// <returns><see cref="IStreamFilterOptions"/></returns>
158+ IStreamFilterOptions ContentEncoding ( string contentEncoding ) ;
159+
160+ /// <summary>Filter on absolute expiry time field.</summary>
161+ /// <param name="absoluteExpiryTime">correlation ID</param>
162+ /// <returns><see cref="IStreamFilterOptions"/></returns>
163+ IStreamFilterOptions AbsoluteExpiryTime ( DateTime absoluteExpiryTime ) ;
164+
165+ /// <summary>Filter on creation time field.</summary>
166+ /// <param name="creationTime">correlation ID</param>
167+ /// <returns><see cref="IStreamFilterOptions"/></returns>
168+ IStreamFilterOptions CreationTime ( DateTime creationTime ) ;
169+
170+ /// <summary>Filter on group ID.</summary>
171+ /// <param name="groupId">correlation ID</param>
172+ /// <returns><see cref="IStreamFilterOptions"/></returns>
173+ IStreamFilterOptions GroupId ( string groupId ) ;
174+
175+ /// <summary>Filter on group sequence.</summary>
176+ /// <param name="groupSequence">correlation ID</param>
177+ /// <returns><see cref="IStreamFilterOptions"/></returns>
178+ IStreamFilterOptions GroupSequence ( uint groupSequence ) ;
179+
180+ /// <summary>Filter on reply-to group.</summary>
181+ /// <param name="groupId">correlation ID</param>
182+ /// <returns><see cref="IStreamFilterOptions"/></returns>
183+ IStreamFilterOptions ReplyToGroupId ( string groupId ) ;
184+
185+ /// <summary>Filter on an application property.</summary>
186+ /// <param name="key">application property key</param>
187+ /// <param name="value">application property value</param>
188+ /// <returns><see cref="IStreamFilterOptions"/></returns>
189+ IStreamFilterOptions Property ( string key , object value ) ;
190+
191+ /// <summary>Filter on an application property as a <see cref="Amqp.Types.Symbol"/></summary>
192+ /// <param name="key">application property key</param>
193+ /// <param name="value">application property value</param>
194+ /// <returns><see cref="IStreamFilterOptions"/></returns>
195+ IStreamFilterOptions PropertySymbol ( string key , string value ) ;
196+
197+ /// <summary>
198+ /// Return the stream options.
199+ /// </summary>
200+ /// <returns><see cref="IStreamOptions"/></returns>
201+ IStreamOptions Stream ( ) ;
202+ }
203+
52204 /// <summary>
53205 /// ListenerContext is a helper class that holds the contexts for the listener
54206 /// </summary>
55- /// <param name="StreamOptions"> Stream Options that the user can change during the SubscriptionListener </param>
56- public record ListenerContext ( IStreamOptions StreamOptions )
207+ public class ListenerContext
57208 {
58- public IStreamOptions StreamOptions { get ; } = StreamOptions ;
209+ private readonly IStreamOptions _streamOptions ;
210+
211+ /// <param name="streamOptions"> Stream Options that the user can change during the SubscriptionListener </param>
212+ public ListenerContext ( IStreamOptions streamOptions )
213+ {
214+ _streamOptions = streamOptions ;
215+ }
216+
217+ public IStreamOptions StreamOptions => _streamOptions ;
59218 }
60219 }
61220}
0 commit comments