I have two console applications. At start, both configure an endpoint like this:
public static async Task<IEndpointInstance> CreateEndpoint()
{
var endpointConfiguration = new EndpointConfiguration("ep");
endpointConfiguration.DisableFeature<TimeoutManager>();
endpointConfiguration.EnableInstallers();
var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
transport.ConnectionString(ConnectionString);
transport.NativeDelayedDelivery().DisableTimeoutManagerCompatibility();
var routing = transport.Routing();
routing.RouteToEndpoint(typeof(DoSomething), "ep");
return await Endpoint.Start(endpointConfiguration);
}
So both applications access the same SQL Server Database and have the same Main
method.
static async Task Main(string[] args)
{
var endpointInstance = await EndpointHelper.CreateEndpoint();
while (true)
{
var key = Console.ReadKey();
switch (key.Key)
{
case ConsoleKey.P:
var command = new MyCommand { SomeProperty = "Test" };
await endpointInstance.Publish(command);
break;
}
}
}
Both console applications have an event handler declared. The problem is that when an event happens, only one of the two console applications gets notified. Sometimes the first, sometimes the second.
Why? What configuration am I missing? I want every console application to react when an event happens.