Skip to main content
phase4 can persist several categories of data to disk. Two configuration properties control where that data lives and whether persistence is enabled at all.

Data path (global.datapath)

The data path is the root directory for persistent application data managed by phase4’s internal managers.
PropertyDefaultDescription
global.datapathphase4-dataRoot directory for persistent data. Relative paths are resolved against the application working directory.
application.properties
# Relative path (resolved from working directory)
global.datapath=phase4-data

# Or an absolute path
#global.datapath=/var/lib/as4/data
When phase4.manager.inmemory=false, the following are stored under global.datapath:
  • PModes — as XML files, one file per PMode.
  • Duplicate detection state — incoming message IDs retained for the configured disposal window.

In-memory vs. file-based managers (phase4.manager.inmemory)

PropertyDefaultDescription
phase4.manager.inmemorytrueWhen true, all managers operate in memory only. When false, data is persisted to global.datapath.
# PModes and state live only in memory.
# All data is lost when the application restarts.
phase4.manager.inmemory=true
For most production deployments, phase4.manager.inmemory=true is the right choice. PModes are typically constructed programmatically at startup and do not need to survive restarts. Set it to false only if you use the web-based PMode management UI or require runtime PMode persistence.

Duplicate detection window

phase4 records the Message ID of every accepted incoming message for a configurable time window. If the same Message ID arrives again within the window, the message is rejected as a duplicate.
PropertyTypeDefaultDescription
phase4.incoming.duplicatedisposal.minuteslong10Minutes that incoming message IDs are retained.
application.properties
# Keep IDs for 30 minutes
phase4.incoming.duplicatedisposal.minutes=30
When phase4.manager.inmemory=true, the duplicate detection state is also kept in memory and resets on restart.

Dump path (phase4.dump.path)

Message dumps are stored separately from the main data path, under phase4.dump.path.
PropertyDefaultDescription
phase4.dump.pathphase4-dumpsRoot directory for message dump files. Relative paths are resolved against the application working directory.
application.properties
phase4.dump.path=/var/lib/as4/dumps
Dumping is controlled at runtime by registering a dumper with AS4DumpManager. The built-in file-based dumpers write files under this path.

What is stored in the dump path

Dump files are organized into subdirectories by direction:
SubdirectoryContents
incoming/Files written by AS4IncomingDumperFileBased — one file per received AS4 message.
outgoing/Files written by AS4OutgoingDumperFileBased — one file per sent AS4 message, per attempt.
Each file is a raw byte stream of the HTTP message body (optionally including HTTP headers if the dumper is configured to include them).

Enabling message dumps

Dumping is off by default. Register a dumper at application startup:
import com.helger.phase4.dump.AS4DumpManager;
import com.helger.phase4.dump.AS4IncomingDumperFileBased;
import com.helger.phase4.dump.AS4OutgoingDumperFileBased;

// Use the dump path from configuration (phase4.dump.path)
AS4DumpManager.setIncomingDumper(new AS4IncomingDumperFileBased());
AS4DumpManager.setOutgoingDumper(new AS4OutgoingDumperFileBased());
Or specify a fixed directory:
import java.io.File;
import com.helger.phase4.dump.AS4DumpManager;
import com.helger.phase4.dump.AS4IncomingDumperFileBased;
import com.helger.phase4.dump.AS4OutgoingDumperFileBased;

File dumpDir = new File("/var/lib/as4/dumps");
AS4DumpManager.setIncomingDumper(
    AS4IncomingDumperFileBased.createForDirectory(dumpDir));
AS4DumpManager.setOutgoingDumper(
    AS4OutgoingDumperFileBased.createForDirectory(dumpDir));
To disable dumping at runtime:
AS4DumpManager.setIncomingDumper(null);
AS4DumpManager.setOutgoingDumper(null);

Full storage configuration example

application.properties
# Persistent data (PModes, duplicate detection)
global.datapath=/var/lib/as4/data
phase4.manager.inmemory=false

# Duplicate detection window
phase4.incoming.duplicatedisposal.minutes=30

# Message dumps
phase4.dump.path=/var/lib/as4/dumps
In containerized deployments, mount a persistent volume at the same path for both global.datapath and phase4.dump.path so that data and dumps survive container restarts.

Build docs developers (and LLMs) love