public static void SetCurrent(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _messagingScenarioFactory.SetValue(() =>
     {
         _fallbackMessagingScenarioFactory = null;
         return messagingScenarioFactory;
     });
 }
 private static bool TryGetFactoryFromConfig(out IMessagingScenarioFactory factory)
 {
     try
     {
         var rockMessagingConfiguration = (IRockMessagingConfiguration)ConfigurationManager.GetSection("rock.messaging");
         factory = rockMessagingConfiguration.MessagingScenarioFactory;
         return true;
     }
     catch (Exception)
     {
         factory = null;
         return false;
     }
 }
        private static IMessagingScenarioFactory CreateDefaultMessagingScenarioFactory()
        {
            try
            {
                IMessagingScenarioFactory value;

                return
                    TryGetFactoryFromConfig(out value)
                        ? value
                        : _fallbackMessagingScenarioFactory;
            }
            finally
            {
                _fallbackMessagingScenarioFactory = null;
            }
        }
 internal static void SetFallback(IMessagingScenarioFactory messagingScenarioFactory)
 {
     _fallbackMessagingScenarioFactory = messagingScenarioFactory;
 }