Kafka KStream - using a StateStore

Im building a KStream based topology and want to use .process() to write some intermediate values to a DB. This step doesn't change the nature of the data so using a map/reduce sort of function seems unnecessary.

Adding a Processor in and of itself is a somewhat lengthy process as one needs to create a ProcessorSupplier and pass this instance to the KStream.process() function along with a State Store name. It's this step that has me a bit baffled.

Here you need to call KStreamBuilder#addStateStore("name-of-your-store") to add the state store to your processor topology. Then, when calling methods such as KStream#process() or KStream#transform(), you must also pass in the name of the state store -- otherwise your application will fail at runtime.