Camunda Job Executor vs External Task — Complete Comparison & Best Practices

 One of the most confusing topics for Camunda developers is:

Should I use Java Delegates (Job Executor) or External Tasks (Workers)?

Both execute service tasks — but their architecture, scalability, and reliability are completely different.

Choosing the wrong one leads to:

  • blocked threads

  • timeouts

  • production incidents

  • impossible scaling

This guide explains the real difference with practical use cases.


Conceptual Difference

FeatureJob ExecutorExternal Task
ExecutionInside engineOutside engine
LanguageJava onlyAny language
ScalabilityLimitedVery high
Failure handlingIncidentRetry controlled
Microservices ready

1) Job Executor (Java Delegate)

The engine executes the code inside its own thread pool.

Flow:

  1. Process reaches service task

  2. Engine locks job

  3. Executes Java code

  4. Continues process

Example

public class PaymentDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) {
paymentService.charge();
}
}

Advantages

✔ Simple
✔ Fast
✔ Good for DB operations

Problems in Production

❌ Engine crash = job lost
❌ Long API calls block engine
❌ Scaling difficult


2) External Task (Worker Pattern)

Engine only creates a task.
Worker pulls and executes it.

Flow:

  1. Process reaches service task

  2. Engine creates external task

  3. Worker fetch & lock

  4. Worker executes

  5. Worker completes

Example (Java Worker)

client.subscribe("charge-payment")
.handler((task, service) -> {
paymentService.charge();
service.complete(task);
});

Advantages

✔ Microservice friendly
✔ Retry safe
✔ Independent scaling
✔ Multi-language support

Tradeoff

Slightly slower than delegate


Failure Behavior (Critical Difference)

ScenarioJob ExecutorExternal Task
API timeoutIncidentRetry
Worker crashProcess stuckRe-fetch
Engine restartLost executionSafe
Network failureIncidentRecoverable

When to Use What

Use Job Executor if:

  • Pure DB logic

  • Millisecond operations

  • Internal logic

  • No remote calls

Use External Task if:

  • REST APIs

  • Payment gateways

  • Email / SMS

  • AI services

  • Microservices


Architecture Recommendation

Modern Camunda architecture:

BPMN Engine = Orchestrator
Workers = Business logic

Never mix heavy logic inside the engine.


Common Production Mistake

Calling REST API inside JavaDelegate

This blocks job executor threads → engine stops processing.

Always use External Task for IO operations.


📚 Recommended Reading

Continue learning Camunda production stability:

👉 https://shikhanirankari.blogspot.com/search/label/English

Suggested topics:

These directly relate to execution strategy selection.


Final Advice

Job Executor = Embedded automation
External Task = Distributed automation

Modern systems always prefer External Tasks.


💼 Professional Support Available

If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.

Technologies covered include Java, Spring Boot, PL/SQL, CMS, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM, Flowable).

📧 Contact: ishikhanirankari@gmail.com | info@realtechnologiesindia.com

🌐 WebsiteIT Trainings | Digital metal podium


Comments

Popular posts from this blog

OOPs Concepts in Java | English | Object Oriented Programming Explained

Scopes of Signal in jBPM

jBPM Installation Guide: Step by Step Setup