Batch execution and recovery

  • Compare whole-batch rollback with bounded work, fenced retries and explicit completion.
Diagram phase
100%

FileUpload processing · illustrative event order

Creation transactionAsync recovery after rollbackOne bad record can roll back a creation batchWork / decisionFailure / recoveryFiles / durable stateA batch spans several records. The SQL claim size may differ from the Java batch size.A successful call is still inside the batch transaction.Mixed valid and invalid records can repeat earlier work.Capture eligible rejects after rollback on the async path.A rejected batch can spend additional broker, MDB and Oracle capacity.The file completion poller reconciles totals separately.A synchronous worker or an async MDB can own an invocation. The retry queue below applies to the async branch.MDB / sync workerCalls the loan creation logic for records in a batch. Individual successful calls can precede a batch rollback.Offer creationThe transaction commits or rolls back the intended batch unit. A file-status poller separately reconciles file totals.OracleThe selected async recovery path records rejects and enqueues eligible work for another batch attempt.Async retryqueue / MDBRun A, B, CWrite AB fails: roll backRecord async rejectsPublish eligible workRetry creation

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • The commit covers a batch of offer creation calls. If row B fails before commit, even a successful call for row A can roll back.
  • A worker exit, broker acknowledgement and committed offer are different milestones. Reconcile file totals using committed results when deciding which rows to retry.
  • File-loader, synchronous worker and MDB capacities each limit a different stage.
  • Check the oldest unfinished file and successful commits alongside queue depth. Increasing consumer count can move the wait into Oracle.
Worker budgets and replay scope

Worker budgets and replay scope

FileUpload work scheduling and Oracle row ownership

Size each execution stage

  • Loader workers limit physical files. JVM-local synchronous workers limit concurrent sync batches. Asynchronous batches wait on Solace and execute through the MDB and its WebLogic Work Manager.
  • Both branches call the creation service and need Oracle capacity. SQL claim size, message batch size and concurrent DB transactions control different resources.
  • An illustrative 30,000 rows at 75 rows per batch yields 400 batches. With 20 free workers, 20 batches can start and 380 remain outstanding. Completion rate depends on service time, DB contention and failures.

A valid row can share a failed transaction

  • If one create call fails before batch commit, earlier calls in the same transaction can roll back. The async path records rejects and republishes eligible retry work. A separate file-status poller reconciles the totals.
  • In the example, rows A and B form one indivisible business group, while C is independent. Invalid B holds A and B. C can commit separately only after the business owner confirms that independence.
  • The selected LOADOFFER timeout procedure considers file status 7 or 9. Both file update and I-row processing start must be older than 30 minutes for the selected I-to-R transition with code 4000. The servlet leaves its timeout analyser unscheduled. This procedure only recovers I rows. Give pending C claims a separate reconciliation path.
Executable example of retry scope and fleet demandjavascript
// Synthetic planning fixture. Run with Node. No broker or database is needed.
'use strict';
const assert = require('node:assert/strict');

// A and B form one indivisible business group. C may commit independently.
const records = [
  {id: 'A', group: 'one', valid: true},
  {id: 'B', group: 'one', valid: false},
  {id: 'C', group: 'two', valid: true}
];
const wholeBatchReplayed = records.length;
const invalidGroups = new Set(records.filter(r => !r.valid).map(r => r.group));
const held = records.filter(r => invalidGroups.has(r.group)).map(r => r.id);
const eligible = records.filter(r => !invalidGroups.has(r.group)).map(r => r.id);
assert.deepEqual(held, ['A', 'B']);
assert.deepEqual(eligible, ['C']);

// Illustrative fleet limits. Each active creation transaction borrows one
// DB connection throughout. Other application users need their reserved share.
const consumers = {synchronous: 12, normalMdb: 16, retryMdb: 8};
const dbBudget = 40 - 12;
const demand = Object.values(consumers).reduce((total, n) => total + n, 0);
assert.equal(demand, 36);
assert.equal(demand - dbBudget, 8);
console.log({wholeBatchReplayed, held, eligible, demand, dbBudget,
  excessConcurrentTransactions: demand - dbBudget});

Bound replay before adding consumers

  • Prevalidate deterministic data errors. Keep checks that depend on current offer/customer state inside the creation transaction. Group updates by the actual business invariant and use a stable receipt for each committed unit.
  • Put permanent or exhausted groups in a review queue with the input identity and error class. Limit normal and retry execution against the same DB budget. Reserve capacity for inquiries and live transactions.
  • Worked limit across all replicas: 12 sync + 16 normal MDB + 8 retry transactions can demand 36 connections. If 28 are available to uploads and each holds one, eight can contend at saturation. Monitor DB borrow time, oldest ready batch and successful commits before raising concurrency.
  • Validate with mixed good/bad groups, duplicate deliveries, commit-before-ack crashes and same-customer conflicts. Compare committed unique outcomes, file totals and replayed rows. Roll back batch sizing independently of retaining the deduplication receipts.