Passing messages from a polling activity

I have a Workflow, which currently calls an Activity (with a RetryPolicy, which runs the activity every 5 seconds, times out in 5 minutes).

I want to pass a message from each Activity run (every 5 seconds) to the Workflow.

Is a recommended approach for the Activity to pass the message in the return err?
And in the Workflow I have a loop which calls the Activity (for 5 minutes, every 5 seconds) (with no RetryPolicy – since my loop is now managing the retrying)?

1 Like

How does the workflow use this information?

The workflow will expose this information in a query handle.
(Think like a “GetProgress” query)

(Also the query handle is actually part of another ParentWorkflow, which the child workflow will pass the Activity response to, via Signal)

An activity can send a signal to its parent or even to an earlier ancestor. However, if this is purely for visibility, consider including progress in an activity heartbeat and the make client call DescribeWorkflowExecution, which includes heartbeat values in the list of pending activities.

Will consider DescribeWorkflowExecution as an alternative.

The data payload is a rather large JSON object (maybe 50-200 fields or so)

Will also consider directly sending the signal from the Activity.

Just to confirm, does my described approach (using the err from the Activity) also work well?

It doesn’t work well, as it will lead to large workflow histories when this data is mostly unused for the workflow logic.