sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

Improve signalWithStart usability

Open Spikhalskiy opened this issue 4 years ago • 3 comments

Workflow#signalWithStart method interface is overcomplicated and hard to use without checking with samples first. We should improve the classes structure and provide more conventional builders and factory methods around this method and functionality.

Spikhalskiy avatar Dec 04 '21 23:12 Spikhalskiy

Such refactoring should keep the strongly typed way to call this method the current implementation provides.

mfateev avatar Jan 23 '22 21:01 mfateev

Wanted to suggest one possible improvement. Currently with signalWithStart we can do for example:

WorkflowStub untyped = WorkflowStub.fromTyped(typedStub);
untyped.signalWithStart(...);

( or just create an untyped stub to start with ) so this works off just WorkflowStub (untyped)

WorkflowClient.signalWithStart only works off typed stubs, for example:

 BatchRequest request = client.newSignalWithStartRequest();
 request.add(myWorkflowStub::exec, input); // exec is workflow method
 request.add(myWorkflowStub::handleSignal, signalData); // handleSignal is a signal method
 client.signalWithStart(request);

It would be nice to add an "untyped" option for WorkflowClient.signalWithStart that takes in signalName, signalData, inputData.

Bonus question, whats the use for WorkflowClient.signalWithStart? When would you use it instead of WorkflowStub.signalWithStart?

tsurdilo avatar Feb 11 '22 18:02 tsurdilo