Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable state persistence through simple file store #112

Open
willypt opened this issue Jan 6, 2024 · 5 comments
Open

Enable state persistence through simple file store #112

willypt opened this issue Jan 6, 2024 · 5 comments
Labels
blocked Blocked by external dependency enhancement New feature or request

Comments

@willypt
Copy link

willypt commented Jan 6, 2024

Proposal

Current implementation of State Extension works very well. However, there will be times when there's a need to persist state through restarts (For example, when upgrading WireMock version).

To tackle this, it would be great to save Caffeine's state separately to a file while running and reading them back after waking up.

References

https://stackoverflow.com/questions/71566146/cache-data-to-local-hdd-with-caffeine#comment126486444_71566146

@willypt willypt added the enhancement New feature or request label Jan 6, 2024
@willypt
Copy link
Author

willypt commented Jan 6, 2024

Ahh, it seems that Store itself is configurable and just need to be reimplemented.
Wondering how should I configure it so that even when its standalone, the store used can still be configured to other than Caffeine

@dirkbolte
Copy link
Collaborator

Currently, Wiremock does not provide a way to pass configuration options to extensions. While stores are configurable, I’m not aware of a way provide them in an extension-like mechanism. And I don’t think making persistence a default would be ok.
one way I can think of to make it work with standalone is to provide an admin interface, so: you can turn options off/on and thus trigger loading of a state or a continuous persistence thereof. Not sure whether this would be an option for your use case.

@willypt
Copy link
Author

willypt commented Jan 7, 2024

Hi Dirk,

thanks for responding. That's a good suggestion that I might just look into! Agree on making persistence as a default would violate the need for interim mocking. While I've tried to implement the persistence layer via Sqlite, it seems that it would be hard to find a way to contribute this feature directly to this repo unless there's admin interface built-in and state-extension is able to be configured directly via the interface 🤔

willypt#1

For reference of the above feature in case there are people looking for the idea of how to override the store quickly 👍🏻

@dirkbolte
Copy link
Collaborator

A small update. I talked with the core wiremock team on both configuration and store options. Long term, the store system of WireMock will be configurable, e.g. by adding custom stores. This will be the way to go for establishing this feature in the end.

As intermediate solution, I'm thinking about adding some configuration options. These options will be phased out as soon as the store system is available though. The feature design for extension-specific configuration options is covered in issue wiremock/wiremock#2579 .

@dirkbolte
Copy link
Collaborator

A small update. I talked with the core wiremock team on both configuration and store options. Long term, the store system of WireMock will be configurable, e.g. by adding custom stores. So any persistence will be covered by that mechanism.

@dirkbolte dirkbolte added the blocked Blocked by external dependency label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by external dependency enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants