Exemple #1
0
        public async Task <TakeOwnershipResponse> Handle(TakeOwnershipRequest request)
        {
            var status = await _controller.TakeOwnership(request.Subject).ConfigureAwait(false);

            var response = new TakeOwnershipResponse
            {
                NodeId  = _graph.NodeId,
                Status  = status,
                Subject = request.Subject
            };

            _logger.InfoMessage(() => new TakeOwnershipRequestReceived(request.Subject, _envelope.ReplyUri)
            {
                Status = response.Status
            });

            return(response);
        }
        public async Task<TakeOwnershipResponse> Handle(TakeOwnershipRequest request)
        {
            var status = await _controller.TakeOwnership(request.Subject).ConfigureAwait(false);

            var response = new TakeOwnershipResponse
            {
                NodeId = _graph.NodeId,
                Status = status,
                Subject = request.Subject
            };

            _logger.InfoMessage(() => new TakeOwnershipRequestReceived(request.Subject, _envelope.ReplyUri)
            {
                Status = response.Status
            });

            return response;
        }
        public Task<TakeOwnershipResponse> Handle(TakeOwnershipRequest request)
        {
            return _controller.TakeOwnership(request.Subject).ContinueWith(t => new TakeOwnershipResponse
            {
                NodeId = _graph.NodeId,
                Status = t.Result,
                Subject = request.Subject
            }).ContinueWith(t => {
                _logger.InfoMessage(() => {
                    var @event = new TakeOwnershipRequestReceived(request.Subject, _envelope.ReplyUri);
                    if (t.Result != null) @event.Status = t.Result.Status;

                    return @event;
                });

                return t.Result;
            });
        }
Exemple #4
0
        public Task <TakeOwnershipResponse> Handle(TakeOwnershipRequest request)
        {
            return(_controller.TakeOwnership(request.Subject).ContinueWith(t => new TakeOwnershipResponse
            {
                NodeId = _graph.NodeId,
                Status = t.Result,
                Subject = request.Subject
            }).ContinueWith(t => {
                _logger.InfoMessage(() => {
                    var @event = new TakeOwnershipRequestReceived(request.Subject, _envelope.ReplyUri);
                    if (t.Result != null)
                    {
                        @event.Status = t.Result.Status;
                    }

                    return @event;
                });

                return t.Result;
            }));
        }
 protected bool Equals(TakeOwnershipRequest other)
 {
     return(Equals(Subject, other.Subject));
 }
 protected bool Equals(TakeOwnershipRequest other)
 {
     return Equals(Subject, other.Subject);
 }
        protected override void theContextIs()
        {
            var request = new TakeOwnershipRequest
            {
                Subject = theSubject
            };

            theServiceBus.ExpectMessage(request)
            .AtDestination(theNode.Addresses.FirstOrDefault())
            .Throws(new DivideByZeroException());

            var task = thePeer.TakeOwnership(theSubject);
            task.Wait(1.Minutes()); // for debugging
            theStatus = task.Result;
        }
        protected override void theContextIs()
        {
            var request = new TakeOwnershipRequest
            {
                Subject = theSubject
            };

            theServiceBus.ExpectMessage(request)
            .AtDestination(theNode.Addresses.FirstOrDefault())
            .Returns(new TakeOwnershipResponse
            {
                Status = OwnershipStatus.OwnershipActivated
            });

            var task = thePeer.TakeOwnership(theSubject);
            task.Wait(1.Minutes()); // for debugging
            theStatus = task.Result;
        }
        protected override void theContextIs()
        {
            var request = new TakeOwnershipRequest
            {
                Subject = theSubject
            };

            theServiceBus.ExpectMessage(request)
            .AtDestination(theNode.ControlChannel)
            .Returns(new TakeOwnershipResponse
            {
                Status = OwnershipStatus.UnknownSubject
            });

            var task = thePeer.TakeOwnership(theSubject);
            task.Wait(1.Minutes()); // for debugging
            theStatus = task.Result;
        }