Skip to content

Commit

Permalink
Add feature flag warning
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
  • Loading branch information
Gsantomaggio committed Sep 19, 2023
1 parent 2b72a3f commit 7111227
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions RabbitMQ.Stream.Client/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ internal static class Consts
internal const string SubscriptionPropertyFilterPrefix = "filter.";
internal const string SubscriptionPropertyMatchUnfiltered = "match-unfiltered";

internal const string FilterNotSupported = "Broker does not support filtering. " +
"You need RabbitMQ 3.13.0 or later and" +
"the stream_filtering feature flag enabled.";

internal static int RandomShort()
{
return Random.Shared.Next(500, 1500);
Expand Down
4 changes: 1 addition & 3 deletions RabbitMQ.Stream.Client/RawConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ internal void Validate()

if (IsFiltering && !AvailableFeaturesSingleton.Instance.PublishFilter)
{
throw new UnsupportedOperationException("Broker does not support filtering. You need " +
"RabbitMQ 3.13.0 or later and " +
"the stream_filtering feature flag enabled.");
throw new UnsupportedOperationException(Consts.FilterNotSupported);
}

switch (ConsumerFilter)
Expand Down
4 changes: 1 addition & 3 deletions RabbitMQ.Stream.Client/RawProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ internal void Validate()
{
if (Filter is { FilterValue: not null } && !AvailableFeaturesSingleton.Instance.PublishFilter)
{
throw new UnsupportedOperationException("Broker does not support filtering. " +
"You need RabbitMQ 3.13.0 or later and" +
"the stream_filtering feature flag enabled.");
throw new UnsupportedOperationException(Consts.FilterNotSupported);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions docs/StreamFilter/StreamFilter/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Server Side Filter Example
--------------------------

WARNING: Filtering requires *RabbitMQ 3.13* or more and the stream_filter feature flag enabled.


This example shows how to use the server side filter to filter the data on the server side.


### Running the Producer

```
Expand Down
2 changes: 1 addition & 1 deletion docs/asciidoc/advanced-topics.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

==== Filtering

WARNING: Filtering requires *RabbitMQ 3.13* or more.
WARNING: Filtering requires *RabbitMQ 3.13* or more and the stream_filter feature flag enabled.

RabbitMQ Stream provides a server-side filtering feature that avoids reading all the messages of a stream and filtering only on the client side.
This helps to save network bandwidth when a consuming application needs only a subset of messages, e.g. the messages from a given geographical region.
Expand Down

0 comments on commit 7111227

Please sign in to comment.