Claimed rows and dispatch

  • Find the failure window between committing a row claim and sending work to the broker.
Diagram phase
100%

FileUpload processing · illustrative event order

Claim a slice of the authorized fileAsync path after commitRow ownership commits before the async sendWork / decisionFiles / durable stateThe default one-second acquisition wait controls how long this request waits.For the illustrated async branch the procedure marks C. The sync branch uses I.The row lock ends. A separate action releases the named lock.A peer may then claim another slice while earlier work executes.If the picker exits before send, the committed C claim remains.A receipt or queue admission alone cannot prove successful business commit.Each processing JVM requests an exclusive application lock keyed by the file ID.Row pickerThe selected procedure marks and commits a bounded staged slice. Session-scoped named lock ownership continues after the row commit.Oracle claimsA Java publication follows the asynchronous C claim. Broker acceptance can be uncertain on send failure.SolaceThe MDB receives async batches and calls the same creation path used by synchronous workers.Batch MDBGet file lockClaim a row sliceClaim committedRelease file lockSend C batchDeliver message

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

  • I marks rows chosen for synchronous work in a local pool. C marks rows chosen for asynchronous dispatch to Solace. Both markers are written to Oracle during the claim.
  • A worker can exit after committing C and before publishing the batch. The row is claimed, even though a queue consumer may have received nothing.
  • The named lock serializes claiming, while two previously claimed slices may execute concurrently.
  • Synchronous I work stays in the local JVM pool. C work crosses the broker boundary.
  • Inspect C-claim recovery and DB/JMS enlistment before deciding whether existing infrastructure closes this crash window.
Staged row claims and Solace handoff

Staged row claims and Solace handoff

FileUpload work scheduling and Oracle row ownership

Two lock lifetimes during row pickup

  • Two processors can work on different slices of one authorized file. Each first requests an exclusive Oracle application lock keyed by file ID.
  • The procedure marks eligible records I for synchronous work or C for asynchronous dispatch, then commits. That ends its row locks. The file-level application lock survives this commit until explicit release or session end.
  • Acquisition wait defaults to one second for this lock request. The 100-second setting retains the lock-name mapping. A blocked acquisition can time out without evicting the current owner.
  • After releasing file ownership, the sync path schedules local workers. The async path sends batches to Solace for an MDB. Both eventually invoke offer creation.

Close the async commit-to-send gap

  • A process can exit after C is committed but before Java sends a message. A send exception presents a second case where the broker might already have accepted the message.
  • First inspect the deployed resource adapter, transaction enlistment, retry jobs and C-claim recovery. An XA-style destination name alone cannot establish this particular atomic handoff.
  • If no equivalent durable dispatcher exists, change the procedure boundary. Commit the claim, its generation and a unique dispatch intent in the same Oracle transaction. A relay can reconstruct pending work.
  • Use a stable operation ID across repeated deliveries. At the consumer, check the generation and commit the business receipt with the Oracle effect. A broker redelivery after commit should find that receipt.
Illustrative claim and dispatch transaction fragmentsql
-- Illustrative Oracle transaction contract. Table and column names are proposed.
-- Supply one stable operation ID for an immutable business group. Membership,
-- input version and expected row count must already be recorded together.
-- The caller holds the existing file claim lock. All statements below use ONE
-- DB transaction. Remove the legacy internal commit before using this boundary.
BEGIN
  IF :operation_id IS NULL OR :input_version IS NULL OR
     :expected_positive_count IS NULL OR :expected_positive_count <= 0 OR
     :expected_generation IS NULL OR :expected_generation < 0 THEN
    RAISE_APPLICATION_ERROR(-20000, 'Invalid claim identity, count, or generation');
  END IF;
  UPDATE demo_stage
     SET claim_state = 'DISPATCH_PENDING', generation = :expected_generation + 1
   WHERE operation_id = :operation_id AND input_version = :input_version
     AND generation = :expected_generation AND claim_state = 'ELIGIBLE';
  IF SQL%ROWCOUNT <> :expected_positive_count THEN
    RAISE_APPLICATION_ERROR(-20001, 'Claim membership changed');
  END IF;

  -- Unique key: (operation_id, generation). Store exact input/membership
  -- references so recovery can reconstruct this message after a restart.
  INSERT INTO demo_dispatch (operation_id, generation, input_version, send_state)
  VALUES (:operation_id, :expected_generation + 1, :input_version, 'PENDING');
  COMMIT;
EXCEPTION WHEN OTHERS THEN
  ROLLBACK;
  RAISE;
END;
/
-- Relay after commit. Broker acceptance followed by relay failure can resend.
-- Consumer in a separate DB transaction:
-- 1. Lock the operation, validate generation and input membership.
-- 2. If the unique business receipt for operation_id exists, return its result.
-- 3. Apply all Oracle business effects and record the receipt in THIS transaction.
-- 4. Commit before acknowledging delivery. Separate remote effects require their
--    own idempotency or authoritative reconciliation contract.

Keep the lock until contention justifies replacement

Option When it helps Cost and acceptance test
Existing named lock plus atomic intent Broker crash gap dominates while claims remain fast Add relay backlog and duplicate checks. Kill the relay on both sides of broker acceptance.
Bounded row pickup with SKIP LOCKED Measured claim-lock waiting delays otherwise available workers Add fairness, file completion checks and owner fencing. Test an old worker returning after takeover.
Shorter polling interval only Healthy pending registrations wait for the next scan More empty scans; a shorter interval cannot recover C rows with no durable dispatch.
  • Activate a single dispatch writer per upload cohort. Disable the old Java sender only when parity checks pass. To roll back, pause new claims, settle acknowledged or ambiguous intents and transfer pending work to one owner.
  • Oracle row skipping supports competing consumers. Test the deployed SQL version, execution plan and file ordering before selecting it.