Skip to content

Commit 81b1409

Browse files
committed
Document filtering considerations
1 parent 7c8aa3f commit 81b1409

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/docs/asciidoc/advanced-topics.adoc

+12
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ include::{test-examples}/FilteringUsage.java[tag=consumer-match-unfiltered]
7272

7373
In the example above, the filtering logic has been adapted to let pass `california` messages _and_ messages without a state set as well.
7474

75+
===== Considerations on Filtering
76+
77+
As stated previously, the server can send messages that do not match the filter value(s) set by consumers.
78+
This is why application developers must be very careful with the filtering logic they define to avoid processing unwanted messages.
79+
80+
What are good candidates for filter values?
81+
Unique identifiers are _not_: if you know a given message property will be unique in a stream, do not use it as a filter value.
82+
A defined set of values shared across the messages is a good candidate: geographical locations (e.g. countries, states), document types in a stream that stores document information (e.g. payslip, invoice, order), categories of products (e.g. book, luggage, toy).
83+
84+
Cardinality of filter values can be from a few to a few thousands.
85+
Extreme cardinality (a couple or dozens of thousands) can make filtering less efficient.
86+
7587
==== Using Native `epoll`
7688

7789
The stream Java client uses the https://netty.io/[Netty] network framework and its Java NIO transport implementation by default.

0 commit comments

Comments
 (0)