示例#1
0
 private async Task AndAMessageIsPublished()
 {
     _message = new GenericMessage {
         Id = Guid.NewGuid()
     };
     await _publisher.PublishAsync(_message);
 }
示例#2
0
        protected override async Task When()
        {
            await Publisher.PublishAsync(new OrderPlaced("1234"));

            await WaitForDone();

            TearDownPubSub();
        }
        private async Task AndAMessageIsPublished()
        {
            _message = new SimpleMessage {
                Id = Guid.NewGuid()
            };
            await _publisher.PublishAsync(_message);

            await Task.Delay(TimeSpan.FromSeconds(1));
        }
示例#4
0
        private async Task WhenMessagesArePublishedToBothRegions()
        {
            _message1 = new GenericMessage {
                Id = Guid.NewGuid()
            };
            _message2 = new GenericMessage {
                Id = Guid.NewGuid()
            };

            await _primaryPublisher.PublishAsync(_message1);

            await _secondaryPublisher.PublishAsync(_message2);
        }
示例#5
0
        private async Task WhenMessagesArePublishedToBothRegions()
        {
            _message1 = new SimpleMessage {
                Id = Guid.NewGuid()
            };
            _message2 = new SimpleMessage {
                Id = Guid.NewGuid()
            };

            await _primaryPublisher.PublishAsync(_message1);

            await _secondaryPublisher.PublishAsync(_message2);

            await Task.Delay(TimeSpan.FromSeconds(1));
        }
示例#6
0
        public async Task <IActionResult> Post([FromBody] CreateSongRequest request)
        {
            if (request.Url == null || !request.Url.Authority.Contains("youtube.com"))
            {
                return(this.BadRequest("Uri is invalid"));
            }

            await _publisher.PublishAsync(new CreateSongCommand
            {
                Url   = request.Url.ToString(),
                Email = request.Email
            });

            return(this.Ok());
        }