Pega has two modern tools for background work: the Queue Processor and the Job Scheduler. Both replaced the older agents, and people often ask which to use. The quick rule: a Queue Processor reacts to an event, a Job Scheduler reacts to the clock. For a full walkthrough of how each one is built, read our detailed post on Queue Processor and Job Scheduler in Pega. This article is a short decision guide.
What each one does
- A Queue Processor takes items that your application puts on a queue and processes them in the background, one item at a time or in parallel across nodes. Items can be processed straight away or after a delay, and failed items can be retried.
- A Job Scheduler runs an activity on a schedule you set, such as every night at 01:00 or every 15 minutes. It does not need anything to be queued.
Decision table
| Question | Queue Processor | Job Scheduler |
|---|---|---|
| What starts it? | Something queues an item | The clock |
| Typical volume | Many small items arriving at any time | One job, run at fixed times |
| Retries on failure | Built in, with a limit you set | You handle it in the activity |
| Spreads work over nodes | Yes | Runs on the nodes you associate it with |
| Best example | Send a confirmation email after an event | Calculate interest every night |
Worked examples
- A customer opens an account. The case queues an item for the welcome email. A Queue Processor sends it, and retries if the mail server is down.
- Every night the bank must post interest. A Job Scheduler starts the interest activity at 01:00.
- Once a week a report goes to branch managers. Job Scheduler.
- A payment file has to be sent to another system as soon as the case is approved, but not more than once. Queue Processor, so it runs when the approval happens and can be retried safely.
Common mistakes
- Using a Job Scheduler that runs every minute just to look for new work. Queue the work instead.
- Putting long-running loops in an activity attached to a screen. Move them to the background.
- Forgetting that both need nodes of the right type. If no node is associated, nothing runs.
Interview tip
Give the one-line rule first (event versus clock), then two examples. For more on how they compare with SLAs, see our deep-dive interview questions on SLA, Queue Processor and Job Scheduler.
No comments:
Post a Comment