Can I persist retrievable data in a workflow that shared by activities?

I’m new to Temporal. I was wondering, is it possible to store some data structure in a running workflow, I want the data can be shared between activities and retrievable from outside by using some SDK method. If it’s possible, would you please direct me to the SDK method that I should use.

btw. I read through all the examples you provide, none of them is related to persist retrievable data in workflows.

All the data inside the workflow is always persisted. So you don’t need to talk to persistence or use special data structures. Just use whatever data structure you want and it will be durable.

To retrieve data from workflow use query feature.

Thanks for your quick reply.

For example, I have 1 workflow with 5 activities. Each activity will take 1 day to process and the outcome will be stored in a data structure shared across all 5 activities. I know this is very normal situation that Temporal can 100% handle.
When I say “outside”, actually we want to have a RESTful API which is able to query the running workflow and retrieve the “shared data structure”. Would you please point me to a Temporal Go SDK method for this feature?


Sure, here is the Go query sample.

Thanks a lot.