Class RecordedRequestsFileSystemPersistence

java.lang.Object
org.mockserver.persistence.RecordedRequestsFileSystemPersistence

public class RecordedRequestsFileSystemPersistence extends Object
Append-only NDJSON (one JSON object per line) persistence for recorded proxied requests and their responses. Unlike RecordedExpectationFileSystemPersistence (which re-serialises the whole recorded-expectation set on every event), this writes a single compact line per FORWARDED_REQUEST exchange and flushes after every line, so durably-captured traffic survives even if the process is later OOM-killed. It is wired in as a per-entry hook on the event-log consumer thread via MockServerEventLog.setRecordedRequestConsumer(java.util.function.Consumer<org.mockserver.log.model.LogEntry>).

When persistRecordedRequestsToDisk is disabled the instance is inert: all fields are null and append(LogEntry) / stop() are no-ops.

  • Constructor Details

    • RecordedRequestsFileSystemPersistence

      public RecordedRequestsFileSystemPersistence(Configuration configuration, MockServerLogger mockServerLogger)
  • Method Details

    • append

      public void append(LogEntry logEntry)
      Append one recorded exchange as a single NDJSON line and flush. Runs on the event-log consumer thread, so it never throws into the caller — any failure is logged at ERROR and swallowed.
    • stop

      public void stop()