Rodrigo Silva
01/28/2020, 1:45 PMEvan R.
01/28/2020, 1:55 PMrecordingCommand
completely generic-use, I’d recommend having it do one of 2 things:
1. Accept a lambda of the form (T) -> Unit
where you can pass your deserialized messages inside the for loop as you receive records (easier, but blocking), or
2. Wrap the body of your function inside a kotlin flow and have the for loop invoke emit()
when it receives new records from Kafka (slightly more complicated, but asynchronous)
Either way, you’re going to need to have that function invoke another function to pass the data along to your database.Rodrigo Silva
01/28/2020, 1:58 PM