コード例 #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);
        }
コード例 #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;
            }));
        }