Storing an index by a counter


hello, I will need help,
the goal of the program is to store a counter index to prevent each node red start or redeploy, indexe starts to zero.
I tried several solutions without success

the storage keeps the value of the idex in memory and changes it into a topic.
if the starting index is1 (initialization) then take the Topic.
But it does not work.

this is what happens after a redeployment



Might I suggest yu read the documentation about context - It may give you some ideas and this thread might help