Step 16 of 21
·
4 minutes
Track Every Transaction
The Scenario
When generating 50,000 statements, stakeholders want to know:
How long until they're done? Can we watch the progress live?
For long-running batch processes, visibility is essential.
The Challenge
How do we track and display progress for long-running jobs?
The Solution
Use
JobContext for logging and progress bars:
public void generateStatements(JobContext context) {
List<Card> cards = cardRepository.findAll();
JobDashboardProgressBar progress = context.progressBar(cards.size());
for (Card card : cards) {
generateStatement(card);
progress.incrementSucceeded();
context.logger().info("Generated statement for {}", card.getNumber());
}
}
The progress bar and logs appear in real-time in the dashboard!
Read the documentation →
Try It Yourself
Trigger a bulk statement generation and watch the progress bar
advance in real-time in the dashboard job details.
You need to log in to perform write operations. You can still view the code solution and dashboard.