Skip to content

Version 2 to 3 Upgrade

Damian Turczynski edited this page Oct 24, 2017 · 4 revisions

Upgrade from version 2 to version 3

There are some breaking changes with version 3. This is a guide which should help you migrate.

Configuration upgrade

With version 3.0 Mjolnir introduces strongly typed config. This replaces string-key based config. New config is represented by MjolnirConfiguration class.

In order to provide the configuration into Mjolnir, it is required to pass an object of MjolnirConfiguration class with all configuration values instantiated. We have provided a sample implementation which will read configuration from a JSON file and reloads configuration when there have been any changes to that file. See ExampleJsonConfigProvider.

For more information about meaning of the configuration go to Configuration

Mapping

Below we provide mapping from old configuration key to new configuration attributes:

mjolnir.command.<command-name>.Timeout -> MjolnirConfiguration.CommandConfigurations[<command-name>].Timeout 
mjolnir.command.s3.FileExistsInS3.Timeout -> MjolnirConfiguration.CommandConfigurations["s3.FileExistsInS3"].Timeout
mjolnir.ignoreTimeouts -> MjolnirConfiguration.IgnoreTimeouts
mjolnir.bulkhead.<bulkhead-key>.maxConcurrent -> MjolnirConfiguration.DefaultCommandConfiguration.Timeout 
mjolnir.bulkhead.default.maxConcurrent -> MjolnirConfiguration.BulkheadConfigurations[<bulkhead-key>].MaxConcurrent
mjolnir.useCircuitBreakers -> MjolnirConfiguration.UseCircuitBreakers
mjolnir.metrics.<breaker-key>.windowMillis -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].WindowMillis
mjolnir.metrics.default.windowMillis -> MjolnirConfiguration.DefaultBreakerConfiguration.WindowMillis
mjolnir.breaker.<breaker-key>.minimumOperations -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].MinimumOperations
mjolnir.breaker.default.minimumOperations -> MjolnirConfiguration.DefaultBreakerConfiguration.MinimumOperations
mjolnir.breaker.<breaker-key>.thresholdPercentage -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].ThresholdPercentage
mjolnir.breaker.default.thresholdPercentage -> MjolnirConfiguration.DefaultBreakerConfiguration.ThresholdPercentage
mjolnir.breaker.<breaker-key>.trippedDurationMillis -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].TrippedDurationMillis
mjolnir.breaker.default.trippedDurationMillis -> MjolnirConfiguration.DefaultBreakerConfiguration.TrippedDurationMillis 
mjolnir.breaker.<breaker-key>.forceTripped -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].ForceTripped
mjolnir.breaker.<breaker-key>.forceFixed -> MjolnirConfiguration.BreakerConfigurations[<breaker-key>].ForceFixed
mjolnir.breaker.default.forceTripped -> MjolnirConfiguration.DefaultBreakerConfiguration.ForceTripped
mjolnir.breaker.default.forceFixed -> MjolnirConfiguration.DefaultBreakerConfiguration.ForceFixed
mjolnir.isEnabled -> MjolnirConfiguration.IsEnabled
mjolnir.bulkheadConfigGaugeIntervalMillis -> N/A (feature no longer available in version 3.0)
mjolnir.breakerConfigGaugeIntervalMillis -> N/A (feature no longer available in version 3.0)

New key:

MjolnirConfiguration.DefaultBulkheadConfiguration.MaxConcurrent 

Configuration updates

Mjolnir supports dynamic configuration updates. In order to achieve this, it is required to call NotifyAfterConfigUpdate method any time config value has been changed.

CommandInvoker creation

Use Dependency Injection mechanism to create and manage a singleton ICommandInvoker throughout an application.

Callers who need static access should consider creating a static singleton wrapper around a single instance of CommandInvoker.

Logging

In Mjolnir 3.0.0 we're removing the hard dependency on log4net, and instead using logging interfaces, giving users of the library the chance to wire up the logging to their preferred implementation. The default implementation in the Mjolnir library is a no-op logger (see DefaultMjolnirLog and DefaultMjolnirLogFactory). Since the primary entry point to the Mjolnir library will be the CommandInvoker, you can pass in your own implementation of the IMjolnirLogFactory here.