Skip to content

Commit 7081e43

Browse files
committed
Implement filters
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent eb55784 commit 7081e43

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

RabbitMQ.AMQP.Client/Consts.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ public static class Consts
2323
/// The default virtual host, <c>/</c>
2424
/// </summary>
2525
public const string DefaultVirtualHost = "/";
26-
26+
2727
// amqp:sql-filter
2828
private const string AmqpSqlFilter = "amqp:sql-filter";
2929
internal static readonly Symbol s_streamSqlFilterSymbol = new(AmqpSqlFilter);
3030
internal const string SqlFilter = "SqlFilter";
31-
31+
3232
internal const string AmqpPropertiesFilter = "amqp:properties-filter";
33-
internal const string AmqpApplicationPropertiesFilter = "amqp:application-properties-filter";
34-
35-
36-
33+
internal const string AmqpApplicationPropertiesFilter = "amqp:application-properties-filter";
34+
3735
// sql-filter
3836
private const string RmqStreamFilter = "rabbitmq:stream-filter";
3937
private const string RmqStreamOffsetSpec = "rabbitmq:stream-offset-spec";
@@ -43,7 +41,5 @@ public static class Consts
4341
internal static readonly Symbol s_streamOffsetSpecSymbol = new(RmqStreamOffsetSpec);
4442
internal static readonly Symbol s_streamMatchUnfilteredSymbol = new(RmqStreamMatchUnfiltered);
4543

46-
47-
4844
}
4945
}

RabbitMQ.AMQP.Client/IConsumerBuilder.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public interface IStreamOptions
101101
/// <see cref="FilterMatchUnfiltered(bool)"/>
102102
IStreamFilterOptions Filter();
103103

104-
105104
/// <summary>
106105
/// Return the consumer builder.
107106
/// </summary>
@@ -194,8 +193,7 @@ public interface IStreamFilterOptions
194193
/// <param name="value">application property value</param>
195194
/// <returns><see cref="IStreamFilterOptions"/></returns>
196195
IStreamFilterOptions PropertySymbol(string key, string value);
197-
198-
196+
199197
/// <summary>
200198
/// <para>SQL filter expression.</para>
201199
///
@@ -204,7 +202,6 @@ public interface IStreamFilterOptions
204202
/// Documentation: <see href="https://www.rabbitmq.com/docs/next/stream-filtering#sql-filter-expressions">SQL Filtering</see>
205203
IStreamFilterOptions Sql(string sql);
206204

207-
208205
/// <summary>
209206
/// Return the stream options.
210207
/// </summary>

RabbitMQ.AMQP.Client/Impl/AmqpConsumerBuilder.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public abstract class StreamOptions : IConsumerBuilder.IStreamOptions
113113
private static readonly Regex s_offsetValidator = new Regex("^[0-9]+[YMDhms]$",
114114
RegexOptions.Compiled | RegexOptions.CultureInvariant);
115115

116-
117116
private readonly Map _filters;
118117

119118
protected StreamOptions(Map filters)
@@ -170,7 +169,6 @@ public IConsumerBuilder.IStreamOptions FilterMatchUnfiltered(bool matchUnfiltere
170169
return this;
171170
}
172171

173-
174172
public abstract IConsumerBuilder Builder();
175173

176174
private void SetOffsetSpecificationFilter(object value)
@@ -256,7 +254,6 @@ public IConsumerBuilder.IStreamFilterOptions Sql(string sql)
256254
throw new ArgumentNullException(nameof(sql));
257255
}
258256

259-
260257
_filters[Consts.SqlFilter] =
261258
new DescribedValue(Consts.s_streamSqlFilterSymbol, sql);
262259
return this;
@@ -315,7 +312,6 @@ public IConsumerBuilder.IStreamFilterOptions PropertySymbol(string key, string v
315312
private StreamFilterOptions PropertyFilter(string propertyKey, object propertyValue)
316313
{
317314

318-
319315
DescribedValue propertiesFilterValue = Filter(Consts.AmqpPropertiesFilter);
320316
Map propertiesFilter = (Map)propertiesFilterValue.Value;
321317
// Note: you MUST use a symbol as the key
@@ -325,7 +321,7 @@ private StreamFilterOptions PropertyFilter(string propertyKey, object propertyVa
325321

326322
private StreamFilterOptions ApplicationPropertyFilter(string propertyKey, object propertyValue)
327323
{
328-
324+
329325
DescribedValue applicationPropertiesFilterValue = Filter(Consts.AmqpApplicationPropertiesFilter);
330326
Map applicationPropertiesFilter = (Map)applicationPropertiesFilterValue.Value;
331327
// Note: do NOT put a symbol as the key

0 commit comments

Comments
 (0)