Last active
November 3, 2020 20:16
-
-
Save fatihdumanli/c7c900ebc81781c904147f1fa9f1de21 to your computer and use it in GitHub Desktop.
Client sends command and publishing events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EventTower; | |
using MessagesCommon; | |
namespace Sender | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//defining endpoint named sender | |
var endpoint = Endpoint.Create("sender"); | |
//starting endpoint | |
endpoint.Start(); | |
var command = new CreateOrder(); | |
command.CustomerId = "5"; | |
//sending CreateOrder comand to ordering endpoint | |
endpoint.Send(command, "ordering"); | |
var @event = new CustomerEmailChanged(); | |
@event.CustomerId = 1; | |
@event.Email = "foo@bar.com"; | |
//publishing the CustomerEmailChanged event to all endpoints | |
endpoint.Publish(@event); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment