public async Task WhenAnEventIsPublished()
 {
     await messagePublisher
     .PublishEvent(
         new TestEvent
     {
         Property = testData.TestEventContent
     },
         new HeaderCollection
     {
         { "Correlation-ID", testData.CorrelationId }
     })
     .ConfigureAwait(false);
 }
Beispiel #2
0
 public async Task WhenAnEventIsPublishedWithDomainUnderTestOutsideThisContext()
 {
     await messagePublisher
     .PublishEvent(
         new TestFirstEvent
     {
         Property = testData.TestEventContent
     },
         new HeaderCollection
     {
         { "DomainUnderTest", "SimpleEventBus.SomethingElse" }
     })
     .ConfigureAwait(false);
 }
        private async Task PublishEvents()
        {
            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("Press the A, B or C keys to publish a test event (then watch the Subscriber process output to see it being handled)");
                Console.WriteLine("Press any other key to exit");
                Console.WriteLine();

                var keyPressed = Console.ReadKey().Key;
                switch (keyPressed)
                {
                case ConsoleKey.A:
                case ConsoleKey.B:
                case ConsoleKey.C:
                    await messagePublisher
                    .PublishEvent(
                        new SomethingHappened
                    {
                        KeyPressed = keyPressed.ToString()
                    });

                    break;

                default:
                    return;
                }
            }
        }
Beispiel #4
0
 public Task WhenAnEventIsPublished()
 => messagePublisher
 .PublishEvent(
     new TestFailoverEvent
 {
     Property = uniqueId.ToString()
 });
        public async Task <IActionResult> Put(int id, [FromBody] string value)
        {
            await messagePublisher
            .PublishEvent(new TestSiteEvent())
            .ConfigureAwait(false);

            return(NoContent());
        }
Beispiel #6
0
        public override async Task HandleMessage(TestFirstEvent message)
        {
            await base
            .HandleMessage(message)
            .ConfigureAwait(false);

            await messagePublisher
            .PublishEvent(new TestSecondEvent { Property = message.Property })
            .ConfigureAwait(false);
        }
Beispiel #7
0
        public async Task PerformMagic()
        {
            var messageToPublish = new TestMessageV1
            {
                Id = Guid.NewGuid().ToString()
            };

            await _messagePublisher.PublishEvent(messageToPublish);

            //await _messagePublisher.ScheduleCommand(messageToPublish, "messages", DateTime.UtcNow);
        }