Skip to main content

Re: can kafka state stores be used as a application level cache by application to modify it from outside the stream topology?

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEI8mthP+5zxXZZdDSO4miYXKq/OgFAl6rS40ACgkQO4miYXKq
/OhBag/8DbqKf2nweOFIgTLdWjEm/FtXTQriBUA6NYx4Ho4OMsQbVflgNZRPfNlI
FFdufoKJ6ZW81GcU+5muPYoJuSWr4eNISXFL5+RGglyk6bhMo6nCqfi2c4srkr5n
Pli5CEeIP1TAepXYSKFCbjjI0hSguMYiFU3ijGZ8FkIARRuyt8kbzyIWktwAUKop
weR+u2yroIZPaaigb7ux/dPsUWw7W/SoMECNf/wdPZdwfZgH5/+Di2YrXQzjz8rL
CAgJkxQcQimv2zefvgIrmJd8f6Mi33VCPfeHoDvVx+//r1wPhWTSYJgKiijuDjXv
GJCteWYwlnr/7J49sIJrUjQ4GtzdM+5PjMpnflu2nGxzSaZDaWG59ovDj3y8wsT6
XDWsEsbHw2ie5p+LsrPa4xt8cV2Jj3zXE5tvqb/j6YjKfSA4urTplWYOudyTz+2d
rjfJQsEC/7FmZA73CpkH2XEzDohBgL2oOV1gAmYsIDj9bNh7Fu+kd7Wgac00Bsl4
nlhHXmXV/AQIXwLhsfo3xBqaOVVY8sr5u38KYv9U2WF/lLezti8RsQ1LDcC0i4dd
DCAT+HeAZH7m7JbVnD9sbnrZFdf58z+lo+nu1ktEnnLRDQw8nrG7jJfx1EW/429c
ZCbcbd/TkdNDD5APlGZjDEMZzHWZInL8zgrTSftLN50I7T3iB+8=
=vRLX
-----END PGP SIGNATURE-----
Yes.

A `GlobalKTable` uses a global store internally.

You can also use `StreamsBuilder.addGlobalStore()` or
`Topology.addGlobalStore()` to add a global store "manually".


-Matthias


On 4/30/20 7:42 AM, Pushkar Deole wrote:
> Thanks Matthias.
> Can you elaborate on the replicated caching layer part?
> When you say global stores, do you mean GlobalKTable created from a topic
> e.g. using StreamsBuilder.globalTable(String topic) method ?
>
> On Thu, Apr 30, 2020 at 12:44 PM Matthias J. Sax <mjsax@apache.org> wrote:
>
>> It's not possible to modify state store from "outside".
>>
>> If you want to build a "replicated caching layer", you could use global
>> stores and write into the corresponding topics to update all stores. Of
>> course, those updates would be async.
>>
>>
>> -Matthias
>>
>> On 4/29/20 10:52 PM, Pushkar Deole wrote:
>>> Hi All,
>>>
>>> I am wondering if this is possible: i have been asked to use state stores
>>> as a general replicated cache among multiple instances of service
>> instances
>>> however the state store is created through streambuilder but is not
>>> actually modified through stream processor topology however it is to be
>>> modified from outside the stream topology. So, essentially, the state
>> store
>>> is just to be created from streambuilder and then to be used as an
>>> application level cache that will get replicated between application
>>> instances. Is this possible using state stores?
>>>
>>> Secondly, if possible, is this a good design approach?
>>>
>>> Appreciate your response since I don't know the internals of state
>> stores.
>>>
>>
>>
>

Comments