Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandSetMethodWithResultInterceptor"/> class.
 /// </summary>
 /// <param name="transmitCommandInvocation">
 ///     The function used to send the information about the method invocation to the owning endpoint.
 /// </param>
 /// <param name="configuration">The object that stores the configuration for the application.</param>
 /// <param name="systemDiagnostics">The function that is used to log messages.</param>
 /// <param name="scheduler">The scheduler that is used to run the tasks.</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="transmitCommandInvocation"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="configuration"/> is <see langword="null" />.
 /// </exception>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />.
 /// </exception>
 public CommandSetMethodWithResultInterceptor(
     SendCommandData transmitCommandInvocation,
     IConfiguration configuration,
     SystemDiagnostics systemDiagnostics,
     TaskScheduler scheduler = null)
     : base(transmitCommandInvocation, configuration, systemDiagnostics)
 {
     m_Scheduler = scheduler ?? TaskScheduler.Default;
 }
        private SendCommandData CommandSendingFunctionFor(EndpointId endpoint)
        {
            SendCommandData func =
                (methodInvocation, retryCount, timeout) =>
            {
                var msg = new CommandInvokedMessage(m_Local, methodInvocation);
                return(m_SendWithResponse(endpoint, msg, retryCount, timeout));
            };

            return(func);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandSetMethodInterceptor"/> class.
        /// </summary>
        /// <param name="transmitCommandInvocation">
        ///     The function used to send the information about the method invocation to the owning endpoint.
        /// </param>
        /// <param name="configuration">The object that stores the configuration for the application.</param>
        /// <param name="systemDiagnostics">The function that is used to log messages.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="transmitCommandInvocation"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="configuration"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="systemDiagnostics"/> is <see langword="null" />.
        /// </exception>
        protected CommandSetMethodInterceptor(
            SendCommandData transmitCommandInvocation,
            IConfiguration configuration,
            SystemDiagnostics systemDiagnostics)
        {
            {
                Lokad.Enforce.Argument(() => transmitCommandInvocation);
                Lokad.Enforce.Argument(() => configuration);
                Lokad.Enforce.Argument(() => systemDiagnostics);
            }

            m_TransmitCommandInvocation = transmitCommandInvocation;
            m_Configuration             = configuration;
            m_Diagnostics = systemDiagnostics;
        }