Esempio n. 1
0
        protected override Action <TMessage> FindReceiver(IInlet <TMessage> inletSendingMessage)
        {
            var leftReceiver  = LeftOutlet.FindReceiver();
            var rightReceiver = RightOutlet.FindReceiver();

            if (leftReceiver == null)
            {
                return(rightReceiver);
            }
            if (rightReceiver == null)
            {
                return(leftReceiver);
            }

            switch (TieBreaker.ResolveTie())
            {
            case TieResult.Left:
                return(leftReceiver);

            case TieResult.Right:
                return(rightReceiver);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        protected override Action <TMessage> FindReceiver(IInlet <TMessage> inletSendingMessage)
        {
            var leftReceiver  = LeftOutlet.FindReceiver();
            var rightReceiver = RightOutlet.FindReceiver();

            if (leftReceiver == null)
            {
                return(null);
            }
            if (rightReceiver == null)
            {
                return(null);
            }

            return(message =>
            {
                leftReceiver(message);
                rightReceiver(message);
            });
        }
Esempio n. 3
0
        protected override Func <TMessage> FindSender(IOutlet <TMessage> outletReceivingMessage)
        {
            var sender = Inlet.FindSender();

            if (sender == null)
            {
                return(null);
            }

            var otherReceiver = outletReceivingMessage == LeftOutlet?RightOutlet.FindReceiver() : LeftOutlet.FindReceiver();

            if (otherReceiver == null)
            {
                return(null);
            }

            return(() =>
            {
                var message = sender();

                otherReceiver(message);

                return message;
            });
        }