Skip to content

Client Advanced Features

baileyjs78 edited this page Aug 16, 2019 · 7 revisions

The advanced features of Moggles and MogglesClient requires that message queuing (provided by RabbitMQ and MassTransit) be enabled. To enable these features in MogglesClient, add the following keys in the application configuration file:

  • .NET Framework
    web.config
  <appSettings>
    <add key="Moggles.UseMessaging" value = "true" />
    <add key="Moggles.MessageBusUrl" value="rabbitmq://myMessageBusUrl" />
    <add key="Moggles.MessageBusUser" value="user" />
    <add key="Moggles.MessageBusPassword" value="password" />
    <add key="Moggles.CacheRefreshQueue" value="my_cache_refresh_queue"/>
  </appSettings>
  • .NET Core
    appsettings.json
"Moggles": {
    "UseMessaging": "true",
    "MessageBusUrl": "rabbitmq://myMessageBusUrl",
    "MessageBusUser": "user",
    "MessageBusPassword": "password",
    "CacheRefreshQueue": "my_cache_refresh_queue"
  } 

Please read more about this features here first 😃.

Force cache refresh

If the impact of a toggle needs to be visible prior to the new refresh time of the cache, a force cache event (triggered by Moggles) can be handled by the client.
MogglesClient will read the message from the queue and based on the Application and Environment matched by the configuration keys provided it will refresh the feature toggles values from the application. The expected message contract can be found here (the namespace of the contract class will also have to match). The cache will be refreshed as soon as the message is published and read from the queue.

Show deployed feature toggles

At application start, the client will search all assemblies for feature toggles and will publish a message containing the feature toggles found in the application. Moggles will receive the message and update the deployed status of the feature toggles. The published message contract can be found here (the namespace of the contract class will also have to match). If you find that startup is slow and your solution has many assemblies, you can improve performance by listed assemblies that can be skipped.

A list of assemblies that can be ignored in the search can be provided (ex: EntityFramework, System, log4net).

  • .NET Framework
    web.config
<appSettings>
    <add key="Moggles.EnvironmentDetectorCustomAssembliesToIgnore" value="Assembly1, Assembly2"/>
</appSettings>
  • .NET Core
    appsettings.json
"Moggles": {
     "EnvironmentDetectorCustomAssembliesToIgnore": "Assembly1, Assembly2"
} 

Clone this wiki locally