title: Can WireMock play and record be used at the same time?
body: <p>I have an application that connect to an external third-party API, and of late the test instance of the API has not been particularly reliable. This stops development progress and turns our build pipelines to red, so I'd like to add an HTTP recording proxy to stop this happening.</p>
  
  <p>I've had <a href="http://wiremock.org/" rel="noreferrer">WireMock</a> recommended, and having tried its <a href="http://wiremock.org/docs/record-playback/" rel="noreferrer">record and play features</a>, it does seem to be very good - it pretty much worked out of the box. We simply change the configured URL for the external service, and then record like this:</p>
  
  <pre><code>java -jar wiremock-standalone-2.3.1.jar \
      --port 8080 \
      --proxy-all="https://test-api.example.com/" \
      --record-mappings \
      --verbose
  </code></pre>
  
  <p>This creates cache folders in the current working dir, and then it can be switched to playback mode by killing the recorder and switching to playback:</p>
  
  <pre><code>java -jar wiremock-standalone-2.3.1.jar \
      --port 8080 \
      --verbose
  </code></pre>
  
  <p>However, to use this in practice I would need to set up an instance of my app running through a test regression pack to record lots of API usage, and to kick that off say one a day. I'd then need to stop the recorder and copy the cache files over to a playback process and then restart the playback process.</p>
  
  <p>This probably would work, but it feels like a lot of moving parts, and ideally I would like to run play and record at the same time. This would allow the cache to be automatically refreshed if a new API call becomes necessary (due to natural project changes) but would playback by default where a match is found.</p>
  
  <p>Is this possible? I am not a Java programmer, but suppose it might be available if one were to write a WireMock plugin. It would be great if this could be done at the console, but the phrasing of the manual indicates that play and record are thought of by the maintainers as separate things.</p>
  
  <p>I did wonder whether I might switch to <a href="http://www.mbtest.org/" rel="noreferrer">Mountebank</a>, which looked like <a href="http://www.mbtest.org/docs/api/proxies" rel="noreferrer">it might support this</a>, however it turns out <a href="https://stackoverflow.com/a/36706200">that play and record are separate modes here too</a>. In any case, I like how easy WireMock has been to get started, so would like to stick with it if possible.</p>