コード例 #1
0
ファイル: ActorProcessor.cs プロジェクト: yfer/akka.net
        public SimpleOutputs(IActorRef actor, IPump pump)
        {
            Actor = actor;
            Pump  = pump;

            SubReceive          = new SubReceive(WaitingExposedPublisher);
            NeedsDemand         = DefaultOutputTransferStates.NeedsDemand(this);
            NeedsDemandOrCancel = DefaultOutputTransferStates.NeedsDemandOrCancel(this);
        }
コード例 #2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="maxBufferSize">TBD</param>
        /// <param name="initialBufferSize">TBD</param>
        /// <param name="self">TBD</param>
        /// <param name="pump">TBD</param>
        /// <param name="afterShutdown">TBD</param>
        /// <exception cref="IllegalStateException">
        /// This exception is thrown when the first message isn't of type <see cref="ExposedPublisher"/>.
        /// </exception>
        public FanoutOutputs(int maxBufferSize, int initialBufferSize, IActorRef self, IPump pump, Action afterShutdown = null)
        {
            _self               = self;
            _pump               = pump;
            _afterShutdown      = afterShutdown;
            MaxBufferSize       = maxBufferSize;
            InitialBufferSize   = initialBufferSize;
            NeedsDemand         = DefaultOutputTransferStates.NeedsDemand(this);
            NeedsDemandOrCancel = DefaultOutputTransferStates.NeedsDemandOrCancel(this);
            SubReceive          = new SubReceive(message =>
            {
                if (!(message is ExposedPublisher publisher))
                {
                    throw new IllegalStateException($"The first message must be ExposedPublisher but was {message}");
                }

                ExposedPublisher = publisher.Publisher;
                SubReceive.Become(DownstreamRunning);
                return(true);
            });
        }