Wiremock - How to add --no-request-journal and where to add?

325 views Asked by At

I have a Wiremock project. It contains request - response json files, gitlab-ci.yaml and dockerfile. And also a GUI project related to wiremock project.

Because the old requests are stored to be matched with further requests, the program is throwing heap memory error.

So I need to add --no-request-journal option to make project not store request history.

Any suggestions?

1

There are 1 answers

0
Lee On

The --no-request-journal is a command line option so where you add it will depend on whether you are running wiremock in docker or not. If you are running wiremock just from the java command then you can add the option onto the end like this:

java -jar wiremock-standalone-3.2.0.jar --no-request-journal

Documentation on this and other command line options can be found on the wiremock website - https://wiremock.org/docs/standalone/java-jar/

If you are running wiremock in docker you will need to add the --no-request-journal to the end of the docker comand:

docker run -it --rm \
  -p "$PORT":"$PORT" \
  --name wiremock \
  -v "$LOCAL_EXTENSIONS_DIR":$DOCKER_EXTENSIONS_DIR \
  -v "$LOCAL_MAPPINGS_DIR":$DOCKER_MAPPINGS_DIR \
  -v "$LOCAL_FILES_DIR":$DOCKER_FILES_DIR \
  wiremock/wiremock:nightly \
  --port "$PORT" --verbose --no-request-journal

The above is a snippet from a script file I use to start wiremock in docker and you can see that we are setting a number of command line options for the port, verbose and the no-request-journal. For reference, the full script can be found here. More information on running wiremock in docker can be found here on the wiremock website - https://wiremock.org/docs/standalone/docker/

Once you have added the option using one of the above ways, you should be able to see if this has worked via the output in the console:

██     ██ ██ ██████  ███████ ███    ███  ██████   ██████ ██   ██
██     ██ ██ ██   ██ ██      ████  ████ ██    ██ ██      ██  ██
██  █  ██ ██ ██████  █████   ██ ████ ██ ██    ██ ██      █████
██ ███ ██ ██ ██   ██ ██      ██  ██  ██ ██    ██ ██      ██  ██
 ███ ███  ██ ██   ██ ███████ ██      ██  ██████   ██████ ██   ██

----------------------------------------------------------------
|               Cloud: https://wiremock.io/cloud               |
|                                                              |
|               Slack: https://slack.wiremock.org              |
----------------------------------------------------------------

port:                         8080
enable-browser-proxying:      false
disable-banner:               false
no-request-journal:           true
verbose:                      false

extensions:                   response-template,webhook

Note the no-request-journal: true in the output.

The above examples were using version 3.2.0 of wiremock and the nightly docker image.