ediverse Explore the platform

Spotlight PEPPOL BIS Billing 3.0 The EU e-invoicing mandate is here — France Sept 2026, Belgium Jan 2026, Germany 2025.

Resequencer

The component that reorders messages — useful when parallel workers publish out of order.

Problem

An INVOIC split into 100 segments processed in parallel can arrive in arbitrary order at the receiver. If order matters (HEAD before LINE before SUMMARY), how to reorder?

Forces

  • Parallelism naturally breaks ordering.
  • Resequencing requires an in-memory buffer with timeout — OOM risk if timeout is mis-calibrated.
  • Some messages may be lost — the resequencer needs a degraded mode.
  • EDI often has business ordering (Header → Detail → Summary).

Solution

A consumer that buffers messages indexed by sequenceId and republishes them in order. Typical mechanism: maintain a nextExpected counter, hold messages with id > nextExpected, release as soon as the expected next one arrives. Configured timeout (5-30 min in EDI) to avoid indefinite blocking.

EDI implementation

In EDI, Resequencer is used to reconstruct an INVOIC from parallel-processed segments, or to reorder MDNs that arrive out of order (rare but possible with proxy/load balancer). Apache Camel implementation: `.resequence().header("sequenceNumber").timeout(30000)`. Performance: ensure buffer is released on timeout to avoid OOM.

Anti-patterns

  • Infinite timeout — memory leak at the first incomplete sequence.
  • Resequencer downstream of a splitter — Composed Message Processor is better.
  • Order guaranteed by default without validation — a missing message blocks indefinitely.

Sources