Ejemplo n.º 1
0
 /// <summary>
 ///     Resolves and invokes all callbacks of the specified type.
 /// </summary>
 /// <param name="action">
 ///     The action to be executed for each callback.
 /// </param>
 /// <param name="scopedServiceProvider">
 ///     The scoped <see cref="IServiceProvider" />. If not provided a new scope will be created.
 /// </param>
 /// <typeparam name="TCallback">
 ///     The type of the callback.
 /// </typeparam>
 public void Invoke <TCallback>(
     Action <TCallback> action,
     IServiceProvider?scopedServiceProvider = null)
 {
     try
     {
         InvokeCore(action, scopedServiceProvider);
     }
     catch (Exception ex)
     {
         _logger.LogCallbackHandlerError(ex);
         throw;
     }
 }
Ejemplo n.º 2
0
 /// <inheritdoc cref="IBrokerCallbacksInvoker.Invoke{THandler}"/>
 public void Invoke <TCallback>(
     Action <TCallback> action,
     IServiceProvider?scopedServiceProvider = null,
     bool invokeDuringShutdown = true)
 {
     try
     {
         InvokeCore(action, scopedServiceProvider, invokeDuringShutdown);
     }
     catch (Exception ex)
     {
         _logger.LogCallbackHandlerError(ex);
         throw;
     }
 }
Ejemplo n.º 3
0
        public void LogCallbackHandlerError_Logged()
        {
            var expectedMessage =
                "Error occurred invoking the callback handler(s).";

            _silverbackLogger.LogCallbackHandlerError(new InvalidCredentialException());

            _loggerSubstitute.Received(
                LogLevel.Error,
                typeof(InvalidCredentialException),
                expectedMessage,
                1103);
        }