Dear camunders,
I have been trying to access data contained in a Google Spreadsheet from within a Camunda process for some time now. Finally, I decided the best option would be to create a process (P1) that launches the Oauth2 flow. Such process contains a single service task (T1) that “does everything”, but the part that the user needs to do manually: authorize access, including starting a listener that waits for the Oauth2 callback. Since (afaik) the service task cannot prompt the user to open a new window (and hence grant the Oauth2 access), I decided to start a process (P2) that again contains a single user task (T2) that prompts the user to open the corresponding URL. P1 then should receive the callback, and the Oauth2 flow should be complete. However, I stumbled into one problem:
- T1 needs to be specified as asyncBefore (or asyncAfter, not too sure) so that task T1 does not block the engine until the listener in T1 finishes; T1 will never finish because for T1 to finish, T2 needs to be completed first (and afaik the engine will not start T2 until T1 is completed).
- In specifying T1 as async, I get two problems:
- that the field injections in the modeller seem not to work. I can bypass this easy by using process variables and execution.getVariable() - is this supposed to be so?
- and more importantly, task T2 is nowhere to be found in the cockpit (and hence the user is never prompted to complete the task). I suspect that these two problems are related, namely, that
DelegateExecution execution
as provided to theexecute
method is not able to provide the appropriate data for
somevariable.getValue(execution).toString();
(which fails with null pointer exception), and
rts = execution.getProcessEngineServices().getRuntimeService("P2"); rts.startProcessInstanceByKey();
which might be starting P2 in some place which I don’t have control over.
So then my questions:
- what am I failing to understand and do correctly when calling
startProcessInstanceByKey
? - is there some other simpler way to do this?
- is there some working oauth2 implementation out there? I wouldn’t think that I’m the first one to stumble into this.
Thanks in advance!
Cheers,
Germán Sanchis-Trilles