Hello dear community,
I noticed that the withStreamNamePrefix(prefix) method, which is part of the server-side filtering, is not working as expected. The filter rather behaves like a “contains” than a “startsWith” filter.
In my scenario, I have two stream types:
book
borrowable-book
In my (Kotlin) code, I set up the filter as follows:
private fun bookSubscriptionFilter(): SubscriptionFilter {
return SubscriptionFilter.newBuilder()
.withStreamNamePrefix("book-") // <<--- NOT WORKING AS EXPECTED!
.build()
}
The problem is that this filter, for some reason, also includes events that are part of the borrowable-book
streams. Hence, for me, this filter acts as a “contains” rather a “startsWith” prefix.
However, if I use the StreamNameRegularExpresssion filter, thinks work fine and as expected:
private fun bookSubscriptionFilter(): SubscriptionFilter {
return SubscriptionFilter.newBuilder()
.withStreamNameRegularExpression("^book") // <<--- works!
.build()
}
Is this an intended behavior? Do I miss some information or don’t fully understand the documentation?
Thanks in advance
Domenic