public async Task <string> Handle(CreateTransactionCommand request, CancellationToken cancellationToken)
        {
            var guid     = Guid.NewGuid();
            var message  = guid + "." + request.FromId + "." + request.ToId + "." + request.Amount;
            var observer = new ReplyObserver();

            _replyService.addObserver(guid.ToString(), observer);
            _messageService.Enqueue(message, "przelew");
            var reply = await observer.WaitForReply();

            return(reply);
        }
Beispiel #2
0
        public async Task <string> Handle(GetAccountByIdQuery request, CancellationToken cancellationToken)
        {
            var guid    = Guid.NewGuid();
            var message = guid + "." + request.AccountId;

            _messageService.Enqueue(message, "get");
            var observer = new ReplyObserver();

            _replyService.addObserver(guid.ToString(), observer);
            var reply = await observer.WaitForReply();

            return(reply);
        }