creek-service / creek-kafka

Creek Kafka support
https://www.creekservice.org/creek-kafka/
Apache License 2.0
5 stars 0 forks source link

State store support #42

Open big-andy-coates opened 2 years ago

big-andy-coates commented 2 years ago

Need way of getting serde for state stores (and re-partition topics)

Persisted store changelog topic names are prefixed with the application.id. This means the resource descriptor, which doesn't know the application id, can't define the topic name.

Two approaches spring to mind:

  1. Provide a KafkaStateStore resource type, which takes the store name, rather than the topic name. Can build the topic name, given the application id. Will also need to know if its persisted or not (i.e. is there a changelog topic or not), and also needs to support windowing
  2. Support having a place holder in the topic name, e.g. "${APPLICATION.ID}-my-first-store-changelog", where the actual topic name is determined by doing a search and replace with the actual app id.

Of these, the first is more work, but is a more fully formed solution. The latter is more of a hack. Maybe.

Random thoughts on the KafkaStateStore solution:

related Kafka issue for removing the need for duplicate changelog topics: https://issues.apache.org/jira/browse/KAFKA-6035

Tutorial should cover different store types. For example, could extend filter service to read whitelist from topic into global store (with global store impl provided by creek?), add scoreboard service with hourly, daily windowed stores and unwindowed version using retention settings only.

big-andy-coates commented 1 year ago

Thoughts...

Should be enough to:

  1. Define a new Store internal resource meta type.
  2. Add new topic method to the streams extension that takes the stores, works out the topic name, and returns a KafkaTopic.

Boom!

Makes sense to have a common KafkaResource base type for topic and store, used to determine if Kafka broker should be started in tests.

Store type wouldn't be auto created. Can't be used as input/output, as topic make isn't fix.