1

I am trying to use addGlobalStore on a Kafka DSL where a need to store few values that I will need global access for all my threads/instances.

My problem is that I need periodically to update these values inside my topology and make all running threads aware of the new values.

I initialized the global store through builder.addGlobalStore and using the init() function of a Processor that was used as the last argument on this function, but I cannot find a way to update the values inside the global store.

The next step on my Topology is a Transformer where I can get a hook through ```init()`` on the global Store and read the stored values but unfortunately I cannot updated them globally. I mean I can update the local copy for the running thread but other threads/instances cannot see the change.

I read somewhere that this cannot be done on Transformer, but even I use a Processor instead the issue remains

So, Is there a way to update globalStateStore on a Kafka DSL topology, and if so how is this possible ? Or in order to use global store do I need to use the low level processor API ?

ypanag
  • 287
  • 5
  • 22

2 Answers2

3

I initialized the global store through builder.addGlobalStore and using the init() function of a Processor that was used as the last argument on this function, but I cannot find a way to update the values inside the global store.

You cannot update a global store directly. Instead, you must update (= write a message to) the underlying topic of that global store.

miguno
  • 14,498
  • 3
  • 47
  • 63
0

In case it fits your needs you probably could use GlobalKTable instead of GlobalStore

dmkvl
  • 732
  • 5
  • 13