kelvien
kelvien

Reputation: 347

How to join KStream and a lookup table (GlobalKTable) on regex / pattern matching?

My goal is to have a stream of data (KStream) that has Integer as its ID , and a String as its value, and for this example, we'll be storing someone's name in the value. And then I will also be creating a lookup table using GlobalKTable that stores terms as its keys (Terms that will be matched with the stream's value) and a boolean flag (Indicates that any name that matches this term is a 'spammer') as the value.

My first question on this regard is if it is possible to join KStream with GlobalKTable on regex / pattern matching rather than a strict match.

If not, is there a better design consideration that I can consider to achieve the same goal ?

Upvotes: 5

Views: 977

Answers (1)

Dmitry Minkovsky
Dmitry Minkovsky

Reputation: 38143

You can use KStream#join(GlobalKTable) to provide a KeyValueMapper that maps items in your KStream to items in your GlobalKTable. In this KeyValueMapper you can match by regex or however you please.

Upvotes: 1

Related Questions