Application startup use-cases

Use-case 1

Users have a set of configuration to start the application. The services might be edited at runtime. During restarts, such added services must not be lost.

Approach:

  1. Start the application by passing a configuration file.

    java -jar -Dgateway.config.file=etc/configuration.json application-2.2.0.jar
  2. Services and sharedConfigs can be added at runtime.

  3. If the application restarts, it will use configuration persisted in the server for this application, which will contain the latest updated configuration.

Use-case 2

Users do not have predefined configuration / cannot use a configuration file to start the application. The configuration for services and sharedConfig will be added later.

Approach:

  1. Start the application without passing a configuration file but with minimal bootstrap configuration to connect to a server.

    java -jar -Dgateway.diffusion.url=ws://localhost:8080 -Dgateway.diffusion.principal=admin -Dgateway.diffusion.password=password -Dgateway.client.id=application-1 application-2.2.0.jar
  2. Services and sharedConfigs can be added at runtime via the Diffusion console.

  3. If the application restarts, it will use configuration persisted in the server for this application.

Use-case 3

Users always want to force the application to use configuration passed via a config file and ignore configuration persisted for it in server.

Approach:

Specify a configuration file with gateway.config.file and set gateway.config.use-local-services to be true when restarting the application.

java -jar -Dgateway.config.file=etc/configuration.json -Dgateway.config.use-local-services=true application-2.2.0.jar

Use-case 4

Users want to use a version-controlled configuration in production, and do not want the application behaviour to change at runtime.

Approach:

Specify Application mode in global configuration to be STATIC. Pass the configuration file with gateway.config.file. This prevents any interactions with services/sharedConfigs at runtime.

Use-case 5

Users want the updated configuration at runtime, to be persisted in a local file as well.

Approach:

Set gateway.config.auto-save-to-file property to be true when starting the application

java -jar -Dgateway.config.file=etc/configuration.json -Dgateway.config.auto-save-to-file=true application-2.2.0.jar
The successful persistence of an updated configuration file relies on the specific machine or environment where the application is running. This is due to the potential variations in the underlying file system and permissions across different machines or operating systems.