예제 #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;
            });
        }
예제 #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;
            }));
        }
예제 #5
0
 protected bool Equals(TakeOwnershipRequest other)
 {
     return(Equals(Subject, other.Subject));
 }
예제 #6
0
 protected bool Equals(TakeOwnershipRequest other)
 {
     return Equals(Subject, other.Subject);
 }
예제 #7
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;
        }
예제 #8
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;
        }
예제 #9
0
        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;
        }