'Spring cloud streams kafka streams state store
I want to get state store with custom key and value.
I have a kafka topic example-kafka-topic-event.
This is how I get ktable at the code level:
@Component("example")
public class DeputyEventListener implements BiConsumer<KStream<String, String>, KTable<String, String>> {
@Override
public void accept(KStream<String, String> deputyEventStream, KTable<String, String> deputyEntity) {
deputyEntity.toStream()
.peek((key, value) -> System.out.println("IN TABLE VALUES IS + " + value + " ON KEY " + key));
}
}
Here with such a property:
spring.cloud.stream.bindings.example-in-1:
destination: example-kafka-topic-event
consumer:
materializedAs: example-state-store
I don't want to use Key Value just like in the kafka topic. I want to convert and use another field in ktable as a key. How can I do this? Is there any option to do such a conversion without losing the convenience of Spring cloud streams?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|