signalWithStart from workflow/activity context in java?

Hi All,

I’m trying to implement the mutex coordination pattern outlined in the samples-go repository (samples-go/mutex_workflow.go at main · temporalio/samples-go · GitHub) in the Java SDK.

I was trying to find something like .signalWithStart that I could call from within the Workflow/Activity context, similar to samples-go/mutex_workflow.go at fbbfc5454c513183520cf2d1707bfa6a26995401 · temporalio/samples-go · GitHub. However, it didn’t seem to exist anywhere except from within WorkflowClient, which I initially assumed was not an option from workflow context.

I then realized that the golang example was faced with the same dilemma and solved it by passing the client context via BackgroundActivityContext, which I am assuming works though I havent tried running it.

My first question is: is there any reason that we can’t have first-class start/signalwithstart from something like ExternalWorkflowStub? If not, is there a way to emulate the BackgroundActivityContext concept in the Java SDK?

-Greg

is there a way to emulate the BackgroundActivityContext concept in the Java SDK?

Pass the WorkflowClient instance you create as input to your activity constructor (when you register activity with your worker(s)).