Rohi
Rohi

Reputation: 814

Service fabric - Updating static configuration files

I am currenlty running an on-premise 3 node cluster with service fabric.

I have a statefull service which has a .csv file containing a complex configuration for my service, and I would like to open a REST endpoint for updating this configuration dynamically.

So, in order to sync the state I could use a reliable dictionary serialize my csv configuration and save it.

What I dont know how to do is to make sure that even after a power-shortage (which is defined as a non-reliable action), the configuration will be saved (since the CSV is saved on the working directory and not in the image store).

I thought about upgrading the service on each update of the CSV, but it seems really exxcessive and will result in multiple application versions provisioned. Is there any standard way to support this?

Upvotes: 0

Views: 129

Answers (1)

pixelTitan
pixelTitan

Reputation: 495

If the .csv file is a requirement, one could treat the .csv file that is deployed with the service as default configuration. So, when the service starts, it could perform the following actions to load in configuration:

  1. Load the .csv default settings into memory.
  2. Load any settings stored in Reliable Collections and merge with the default settings previously loaded from the .csv file.

In this way, the dynamically updated settings will be replicated reliably due to using the Reliable Collections, and the .csv is already replicated due to being a default artifact deployed with all replicas of the service.

Upvotes: 1

Related Questions