Skip to content

Instantly share code, notes, and snippets.

@fatihdumanli
Last active November 3, 2020 20:16
Show Gist options
  • Save fatihdumanli/c7c900ebc81781c904147f1fa9f1de21 to your computer and use it in GitHub Desktop.
Save fatihdumanli/c7c900ebc81781c904147f1fa9f1de21 to your computer and use it in GitHub Desktop.
Client sends command and publishing events
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