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;
            });
        }
예제 #2
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));
 }
예제 #5
0
        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;
        }
예제 #6
0
        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;
        }