コード例 #1
0
ファイル: Service.cs プロジェクト: lulzzz/holon-net
        /// <summary>
        /// Handles a single envelope asyncronously.
        /// </summary>
        /// <param name="envelope">The envelope.</param>
        private async Task ServiceHandleAsync(Envelope envelope)
        {
            // process filters, if any handler in the chain returns false we ditch this envelope
            if (_configuration.Filters.Length > 0)
            {
                foreach (IServiceFilter filter in _configuration.Filters)
                {
                    if (!await filter.HandleAsync(envelope).ConfigureAwait(false))
                    {
                        return;
                    }
                }
            }

            // actually run handler
            await _behaviour.HandleAsync(envelope).ConfigureAwait(false);
        }
コード例 #2
0
        /// <summary>
        /// Handles a single envelope asyncronously.
        /// </summary>
        /// <param name="envelope">The envelope.</param>
        private async Task ServiceHandleAsync(Envelope envelope)
        {
            // process filters, if any handler in the chain returns false we ditch this envelope
            if (_configuration.Filters.Length > 0)
            {
                foreach (IServiceFilter filter in _configuration.Filters)
                {
                    if (!await filter.HandleAsync(envelope).ConfigureAwait(false))
                    {
                        return;
                    }
                }
            }

            // trace begin
            _namespace.Node.OnTraceBegin(new TraceEventArgs(envelope, _behaviour));

            // actually run handler
            await _behaviour.HandleAsync(envelope).ConfigureAwait(false);

            // trace end
            _namespace.Node.OnTraceEnd(new TraceEventArgs(envelope, _behaviour));
        }