Hi,
Are there disadvantages to having a JavaDelegate
block for 10 minutes (mostly waiting on IO)? What about 10 days? For example, does this interfere with features such as process instance suspension? And can async continuations help work around any disadvantages?
This article (our use case is similar but with Request/Acknowledge/Poll) gives me the impression that this shouldn’t be done in a JavaDelegate
. We’d like to use JavaDelegate
instead of AbstractBpmnActivityBehavior
because it can be retried from Camunda Cockpit, and external tasks feels like a heavy interface for running delegates in the same process.
Thanks,
Mike
Hi Mike,
My 2 cents - yes blocking for long periods can be bad…
Rationale, a java delegate will typically run in either a foreground thread, or background job executor thread. Threads come from a finite resource pool. Hence if your request arrival rate exceeds your throughput rate, you will run out of resource and the system will tend to grind to a halt.
If you really do need to block for long periods, consider asynchronous integration patterns (eg service task with receive task, the asynchronous service task inplementation or the external task pattern. The external task pattern could work here on the assumption that the external client can scale out and thus does not impact engine resources…
regards
Rob
Hi @mikepii
the article you are referreing is quite old and in the meantime the patterns have improved a lot.
If you run a JavaDelegate
for 10 minutes/days, the engine will keep a database connection open for 10 minutes/days. The db-admins usually start to complain if it’s more than 30 sec.
Have a look at Bernds post, especially the last chapter about use cases: https://blog.camunda.com/post/2015/11/external-tasks/. And Tassilo showed the way to use your (long running) business logic in the external task java client: https://blog.camunda.com/post/2018/04/camunda-external-task-client-java-010-alpha2-released/. The first version of the java client has been released last week.
There is no need to subclass AbstractBpmnActivityBehavior
any more.
Cheers, Ingo
1 Like