Record Many Mode
One of the Runner’s available modes isrecord-many mode.
The runner can be started in record-many mode by setting the WMC_DEFAULT_MODE environment variable to record-many,
or switched to this mode using the Runner’s switch endpoint.
This mode starts a multi-domain recording session that will continue to record until the
runner is stopped or its mode is switched.
Record Many Configuration
The record many session started by the Runner can be configured via the same mechanism as therecord-many command
of the WireMock CLI - either via a values file or via environment variables.
Just like the WireMock CLI, by default the Runner will expect a WireMock environment file in the .wiremock directory
in the current working directory of the container.
Choosing which services to record
Like all other options available to the WireMock CLI’srecord-many command, the
--include-services option is available to the
Runner’s record-many mode.
In addition to being configurable at start-up time, the services to include in the
recording session can be configured at switch time, via the HTTP PUT request to
/v1/mode.
To configure this value via the switch request, provide a "config" field in the JSON request body, alongside the
"mode" field, that contains an "include-services" field, like so:
request
--include-services option, the value of the
"include-services" field must be a comma separated list of the service keys that correspond to the desired services to
record.
Flushing Recordings
Therecord-many mode will honour the batching configuration you
have specified in your config file. The Runner also defines an endpoint which can be used to flush the recorded requests
to WireMock Cloud independently of the batching configuration:
POST /v1/record-many/flush
When the Runner is stopped or switched out of record-many mode, recorded requests will not be flushed automatically.
To ensure all your recordings are saved to WireMock Cloud, call
POST /v1/record-many/flush before stopping the recording session.Starting the Runner In Record Many Mode
When starting the runner inrecord-many mode you will need to publish the appropriate ports
for the services you are running along with the port you have configured for the Runner.
Here is a typical example on Linux or macOS when running the Runner on port 9999 and recording to two Mock APIs: