当前位置: 首页>>代码示例>>C#>>正文


C# IPipe类代码示例

本文整理汇总了C#中IPipe的典型用法代码示例。如果您正苦于以下问题:C# IPipe类的具体用法?C# IPipe怎么用?C# IPipe使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IPipe类属于命名空间,在下文中一共展示了IPipe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PipeInstancesAddedEventArgs

 public PipeInstancesAddedEventArgs(IPipe[] pipes)
 {
     if (pipes == null)
         _Pipes = new IPipe[0];
     else
         _Pipes = pipes;
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:7,代码来源:PipeInstancesAddedEventArgs.cs

示例2: Receiver

        async void Receiver(IPipe<ConnectionContext> transportPipe, TaskSupervisor supervisor)
        {
            await Repeat.UntilCancelled(supervisor.StopToken, async () =>
            {
                try
                {
                    await _host.ConnectionCache.Send(transportPipe, supervisor.StopToken).ConfigureAwait(false);
                }
                catch (RabbitMqConnectionException ex)
                {
                    if (_log.IsErrorEnabled)
                        _log.ErrorFormat("RabbitMQ connection failed: {0}", ex.Message);

                    var inputAddress = _host.Settings.GetInputAddress(_settings);

                    await _endpointObservers.Faulted(new Faulted(inputAddress, ex)).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                }
                catch (Exception ex)
                {
                    if (_log.IsErrorEnabled)
                        _log.ErrorFormat("RabbitMQ receive transport failed: {0}", ex.Message);

                    var inputAddress = _host.Settings.GetInputAddress(_settings);

                    await _endpointObservers.Faulted(new Faulted(inputAddress, ex)).ConfigureAwait(false);
                }
            }).ConfigureAwait(false);
        }
开发者ID:JackWangCUMT,项目名称:MassTransit,代码行数:31,代码来源:RabbitMqReceiveTransport.cs

示例3: Start

        public ReceiveTransportHandle Start(IPipe<ReceiveContext> receivePipe)
        {
            if (_log.IsDebugEnabled)
                _log.DebugFormat("Starting receive transport: {0}", new Uri(_host.Settings.ServiceUri, _settings.QueueDescription.Path));

            var supervisor =
                new TaskSupervisor($"{TypeMetadataCache<ServiceBusReceiveTransport>.ShortName} - {_host.Settings.GetInputAddress(_settings.QueueDescription)}");

            IPipe<ConnectionContext> connectionPipe = Pipe.New<ConnectionContext>(x =>
            {
                x.UseFilter(new PrepareReceiveQueueFilter(_settings, _subscriptionSettings));

                if (_settings.QueueDescription.RequiresSession)
                {
                    x.UseFilter(new MessageSessionReceiverFilter(receivePipe, _receiveObservers, _endpointObservers, supervisor));
                }
                else
                {
                    x.UseFilter(new MessageReceiverFilter(receivePipe, _receiveObservers, _endpointObservers, supervisor));
                }
            });

            Receiver(connectionPipe, supervisor);

            return new Handle(supervisor);
        }
开发者ID:phatboyg,项目名称:MassTransit,代码行数:26,代码来源:ServiceBusReceiveTransport.cs

示例4: HandleMessage

 public void HandleMessage(object message, IPipe pipe)
 {
     lock (this) {
         this.lastMessage = message;
     }
     waiter.Set();
 }
开发者ID:ccidral,项目名称:courier,代码行数:7,代码来源:HandlerMock.cs

示例5: Receiver

        public Receiver(MessageReceiver messageReceiver, Uri inputAddress, IPipe<ReceiveContext> receivePipe, ReceiveSettings receiveSettings,
            IReceiveObserver receiveObserver, ITaskSupervisor supervisor)
        {
            _messageReceiver = messageReceiver;
            _inputAddress = inputAddress;
            _receivePipe = receivePipe;
            _receiveSettings = receiveSettings;
            _receiveObserver = receiveObserver;
            _supervisor = supervisor;

            _participant = supervisor.CreateParticipant();

            var options = new OnMessageOptions
            {
                AutoComplete = false,
                AutoRenewTimeout = receiveSettings.AutoRenewTimeout,
                MaxConcurrentCalls = receiveSettings.MaxConcurrentCalls
            };

            options.ExceptionReceived += (sender, x) =>
            {
                if (_log.IsErrorEnabled)
                    _log.Error($"Exception received on receiver: {_inputAddress} during {x.Action}", x.Exception);

                _participant.SetComplete();
            };

            messageReceiver.OnMessageAsync(OnMessage, options);

            _participant.SetReady();

            SetupStopTask();
        }
开发者ID:JackWangCUMT,项目名称:MassTransit,代码行数:33,代码来源:Receiver.cs

示例6: ProcessHandshake

        public void ProcessHandshake(int TimeOut, ref IPipe pipe)
        {
            //usar un waithandle por cada tipo de handshake.
            //Estos waithandles seran liberados cuando la maquina de estados
            //alcance un estado que libere el wait handle.

            try
            {
                LogCurrentState();
                LogSession.LogMessage("Processing Handshake @ WEIGHT Station...");
                this.Workflow.Start();

                //if (!this.Workflow.WaitForResult(TimeOut))
                //{
                //    throw new TimeoutException("Timeout waiting for StableState");
                //}
                LogSession.LogMessage("Weight Workflow Done");
                this.Workflow.Reset();
            }
            catch (Exception exception)
            {
                LogSession.LogException(exception);
                throw exception;
            }
        }
开发者ID:gvallejo,项目名称:reajetservice,代码行数:25,代码来源:PurgeCommandHandler.cs

示例7: SendUsingNewConnection

        Task SendUsingNewConnection(IPipe<OwinHostContext> connectionPipe, OwinHostScope scope, CancellationToken stoppingToken)
        {
            try
            {
                if (_cacheTaskScope.StoppingToken.IsCancellationRequested)
                    throw new TaskCanceledException($"The connection is being disconnected: {_settings.ToDebugString()}");

                if (_log.IsDebugEnabled)
                    _log.DebugFormat("Connecting: {0}", _settings.ToDebugString());
                
                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Connected: {0} (address: {1}, local: {2}", _settings.ToDebugString(),
                        _settings.Host, _settings.Port);
                }

                var hostContext = new HttpOwinHostContext(_settings, _cacheTaskScope);

                hostContext.GetOrAddPayload(() => _settings);

                scope.Connected(hostContext);
            }
            catch (Exception ex)
            {
                Interlocked.CompareExchange(ref _scope, null, scope);

                scope.ConnectFaulted(ex);

                throw new HttpConnectionException("Connect failed: " + _settings.ToDebugString(), ex);
            }

            return SendUsingExistingConnection(connectionPipe, scope, stoppingToken);
        }
开发者ID:MassTransit,项目名称:MassTransit,代码行数:33,代码来源:OwinHostCache.cs

示例8: HandleMessage

 public void HandleMessage(object message, IPipe pipe)
 {
     //TODO handle message in another thread using a queue
     foreach (IHandler handler in handlers)
     {
         handler.HandleMessage(message, this);
     }
 }
开发者ID:ccidral,项目名称:courier,代码行数:8,代码来源:TcpPipe.cs

示例9: SendUsingNewConnection

        Task SendUsingNewConnection(IPipe<ConnectionContext> connectionPipe, ConnectionScope scope, CancellationToken cancellationToken)
        {
            try
            {
                if (_cacheTaskScope.StoppingToken.IsCancellationRequested)
                    throw new TaskCanceledException($"The connection is being disconnected: {_settings.ToDebugString()}");

                if (_log.IsDebugEnabled)
                    _log.DebugFormat("Connecting: {0}", _settings.ToDebugString());

                IConnection connection;
                if (_settings.ClusterMembers?.Any() ?? false)
                {
                    connection = _connectionFactory.CreateConnection(_settings.ClusterMembers, _settings.ClientProvidedName);
                }
                else
                {
                    var hostNames = Enumerable.Repeat(_settings.Host, 1).ToList();

                    connection = _connectionFactory.CreateConnection(hostNames, _settings.ClientProvidedName);
                }


                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("Connected: {0} (address: {1}, local: {2}", _settings.ToDebugString(),
                        connection.Endpoint, connection.LocalPort);
                }

                EventHandler<ShutdownEventArgs> connectionShutdown = null;
                connectionShutdown = (obj, reason) =>
                {
                    Interlocked.CompareExchange(ref _scope, null, scope);

                    scope.Shutdown(reason.ReplyText);

                    connection.ConnectionShutdown -= connectionShutdown;
                };

                connection.ConnectionShutdown += connectionShutdown;

                var connectionContext = new RabbitMqConnectionContext(connection, _settings, _cacheTaskScope);

                connectionContext.GetOrAddPayload(() => _settings);

                scope.Connected(connectionContext);
            }
            catch (BrokerUnreachableException ex)
            {
                Interlocked.CompareExchange(ref _scope, null, scope);

                scope.ConnectFaulted(ex);

                throw new RabbitMqConnectionException("Connect failed: " + _settings.ToDebugString(), ex);
            }

            return SendUsingExistingConnection(connectionPipe, scope, cancellationToken);
        }
开发者ID:phatboyg,项目名称:MassTransit,代码行数:58,代码来源:RabbitMqConnectionCache.cs

示例10: CopyToArrayCopiesZeroPipesToArrayIfNoneAreSelected

        public void CopyToArrayCopiesZeroPipesToArrayIfNoneAreSelected()
        {
            Guid[] ids = InitializeTestEntries(3);

            IPipe[] arr = new IPipe[0];

            _selected.CopyTo(arr, 0);
            Assert.Equal(0, arr.Length);
        }
开发者ID:BgRva,项目名称:Blob1,代码行数:9,代码来源:PipesSelectedCollectionFixture.cs

示例11: AddPipe

        public static void AddPipe(IPipe pipe)
        {
            if (Pipeline.Any(existingPipe => existingPipe.GetType() == pipe.GetType()))
            {
                return;
            }

            Pipeline.Add(pipe);
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:9,代码来源:HttpModule.cs

示例12: AddPipe

		public static void AddPipe(IPipe pipe)
		{
			foreach( var existingPipe in _pipeline )
			{
				if( existingPipe.GetType () == pipe.GetType () )
					return;
			}
			_pipeline.Add (pipe);
		}
开发者ID:LenFon,项目名称:Bifrost,代码行数:9,代码来源:HttpModule.cs

示例13: UseDeadLetterQueue

        /// <summary>
        /// Rescue exceptions via the alternate pipe
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="rescuePipe"></param>
        public static void UseDeadLetterQueue(this IPipeConfigurator<ReceiveContext> configurator, IPipe<ReceiveContext> rescuePipe)
        {
            if (configurator == null)
                throw new ArgumentNullException(nameof(configurator));

            var rescueConfigurator = new DeadLetterPipeSpecification(rescuePipe);

            configurator.AddPipeSpecification(rescueConfigurator);
        }
开发者ID:MassTransit,项目名称:MassTransit,代码行数:14,代码来源:DeadLetterExtensions.cs

示例14: RabbitMqConsumer

        /// <summary>
        /// Adds a RabbitMQ Basic Consumer to the pipeline
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="pipe"></param>
        /// <param name="settings"></param>
        /// <param name="receiveObserver"></param>
        /// <param name="endpointObserver"></param>
        /// <param name="exchangeBindings"></param>
        /// <param name="taskSupervisor"></param>
        /// <param name="mediator"></param>
        public static void RabbitMqConsumer(this IPipeConfigurator<ConnectionContext> configurator, IPipe<ReceiveContext> pipe, ReceiveSettings settings, IReceiveObserver receiveObserver, IReceiveEndpointObserver endpointObserver, IEnumerable<ExchangeBindingSettings> exchangeBindings, ITaskSupervisor taskSupervisor, Mediator<ISetPrefetchCount> mediator)
        {
            if (configurator == null)
                throw new ArgumentNullException(nameof(configurator));

            var pipeBuilderConfigurator = new RabbitMqConsumerPipeSpecification(pipe, settings, receiveObserver, endpointObserver, exchangeBindings, taskSupervisor, mediator);

            configurator.AddPipeSpecification(pipeBuilderConfigurator);
        }
开发者ID:kotvisbj,项目名称:MassTransit,代码行数:20,代码来源:ConsumerPipeConfiguratorExtensions.cs

示例15: SendUsingNewModel

        async Task SendUsingNewModel(IPipe<ModelContext> modelPipe, ModelScope scope, CancellationToken cancellationToken)
        {
            IPipe<ConnectionContext> connectionPipe = Pipe.ExecuteAsync<ConnectionContext>(async connectionContext =>
            {
                IModel model = await connectionContext.CreateModel().ConfigureAwait(false);

                EventHandler<ShutdownEventArgs> modelShutdown = null;
                modelShutdown = (obj, reason) =>
                {
                    model.ModelShutdown -= modelShutdown;

                    Interlocked.CompareExchange(ref _scope, null, scope);

                    scope.Close();
                };

                model.ModelShutdown += modelShutdown;

                var modelContext = new RabbitMqModelContext(connectionContext, model, connectionContext.CancellationToken);

                scope.Connected(modelContext);

                try
                {
                    using (SharedModelContext context = await scope.Attach(cancellationToken).ConfigureAwait(false))
                    {
                        await modelPipe.Send(context).ConfigureAwait(false);
                    }
                }
                catch (Exception ex)
                {
                    if (_log.IsDebugEnabled)
                        _log.Debug("The existing model usage threw an exception", ex);

                    Interlocked.CompareExchange(ref _scope, null, scope);

                    scope.Close();

                    throw;
                }
            });

            try
            {
                await _connectionCache.Send(connectionPipe, new CancellationToken()).ConfigureAwait(false);
            }
            catch (Exception exception)
            {
                if (_log.IsDebugEnabled)
                    _log.Debug("The connection threw an exception", exception);

                Interlocked.CompareExchange(ref _scope, null, scope);

                throw;
            }
        }
开发者ID:kotvisbj,项目名称:MassTransit,代码行数:56,代码来源:RabbitMqModelCache.cs


注:本文中的IPipe类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。