Hello all,
A question on Broadcast State pattern:
Scenario: I have a High throughput inventory sales data and another reference data that has details of max stock of each product ( Just around 2000 records but will receive updates and deletes). So basically i would want to alert if the stock sales crosses this thresold.
My first solution was to use the Broadcast state pattern, where i broadcasted the Threshold data in a KeyedBroadcastProcessFunction to the sales data. Now my overall parallelism is >1 for the job.
The threshold event comes to Kafka as kind of change events ( create, update, deletes ) and so I will have to reconcile the state as per the change type ). This reconciliation Im doing in the
processBroadcastElement
function
Question: Is Broadcasting the state the right approach ? I'm specifically confused on following points:
1. Will the broadcasted state be consistent across the parallel instances of the non-broadcasted stream ?
2. Since I have the CDC kind of data in the broadcasted stream, I believe the state update that i make will be consistent across the parallel tasks of the non-broadcasted stream ?
3. Should I change the parallelism of the broadcast stream to 1 ?
4. Or does it seems good to just use a KeyedCoProcessJoin for this ?