Reuse of the workflow stubs

Hello Team,

Based on this topic

Below is the scenario

T1 time :

  • Workflow instance ( wf-obj1) is created
  • From client side workflow stub ( wf-stub-obj1) is created
  • The same stub ( wf-stub-obj1 ) is reused for sending multiple signals, to the
    same workflow instance ( wf-obj1 )

T2 time :

  • Workflow instance (wf-obj1) is crashed and recreated from history events with new instance ( wf-obj2)

Question ?

  • Considering this scenario, From client side can we still use workflow stub (wf-stub-obj1 ) to send signals to workflow instance (wf-obj2) or do we need to recreate the stubs.

  • Is it a good practice to cache the stubs ( to preserve cpu and memory resources ) or recreate everytime

do we need to recreate the stub

Yes use stub for existing execution.

cache the stubs

Workflow stubs are per workflow instance so if its for same instance you can reuse