Workflows + Signals

Greetings. I think some clarity is needed on the doc page describing the java Workflow Interface. It should be made clear that when using signals, it is important to use the factory pattern for creating workflow instance implementations, i.e. Worker#addWorkflowImplementationFactory(…). The other workflow examples register just a singleton implementation, which isn’t going to work with signals (although it might be possible to hack it with nasty thread-locals). Also, it’s not clear what the scoping of the addWorkflowImplementationFactory(…) is. I assume it would be to each individual workflow call. Full disclosure, I haven’t tried coding this case yet (we’re fighting with it in SWF), but will hopefully try later today (using Spring). Many thanks!

I don’t understand the question.

addWorkflowImplementationFactory should not be used at all unless you are doing framework level integrations or unit testing. Signals do work fine when using Worker.registerWorkflowImplementationTypes. Look at the sample that demonstrates this.