Esempio n. 1
0
        public ICompletes <Response> RequestWith(Request request)
        {
            var completes = _configuration.KeepAlive
                ? Completes.RepeatableUsing <Response>(_configuration.Stage.Scheduler)
                : Completes.Using <Response>(_configuration.Stage.Scheduler);

            _consumer.RequestWith(request, completes);
            return(completes);
        }
Esempio n. 2
0
        public ICompletes <Response> RequestWith(Request request)
        {
            var completes = _configuration.KeepAlive
                ? Completes.RepeatableUsing <Response>(_configuration.Stage.Scheduler)
                : Completes.Using <Response>(_configuration.Stage.Scheduler);

            request.Headers.And(RequestHeader.Connection, _configuration.KeepAlive ? Header.ValueKeepAlive : Header.ValueClose);
            _consumer.RequestWith(request, completes);
            return(completes);
        }
        public ICompletes <Response> RequestWith(Request request, ICompletes <Response> completes)
        {
            if (!_actor.IsStopped)
            {
                Action <IClientConsumer> consumer = actor => actor.RequestWith(request, completes);
                var innerCompletes = Completes.Using <Response>(_actor.Scheduler);
                if (_mailbox.IsPreallocated)
                {
                    _mailbox.Send(_actor, consumer, innerCompletes, RequestWithRepresentation1);
                }
                else
                {
                    _mailbox.Send(new LocalMessage <IClientConsumer>(_actor, consumer, innerCompletes, RequestWithRepresentation1));
                }
            }
            else
            {
                _actor.DeadLetters?.FailedDelivery(new DeadLetter(_actor, RequestWithRepresentation1));
            }

            return(null !);
        }
        public ICompletes <int> Port()
        {
            if (!actor.IsStopped)
            {
                var completes = Completes.Using <int>(actor.Scheduler);
                Action <IServerRequestResponseChannel> consumer = x => x.Port();
                if (mailbox.IsPreallocated)
                {
                    mailbox.Send(actor, consumer, completes, RepresentationPort4);
                }
                else
                {
                    mailbox.Send(new LocalMessage <IServerRequestResponseChannel>(actor, consumer, completes, RepresentationPort4));
                }
                return(completes);
            }
            else
            {
                actor.DeadLetters.FailedDelivery(new DeadLetter(actor, RepresentationPort4));
            }

            return(null !);
        }