Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Persistence;
namespace Backend
{
class Program
{
static void Main(string[] args)
{
StartBackend().GetAwaiter().GetResult();
StartFrontend().GetAwaiter().GetResult();
}
static async Task StartBackend()
{
var config = new EndpointConfiguration("Backend");
config.UseTransport<MsmqTransport>();
var persistence = config.UsePersistence<NHibernatePersistence>();
persistence.ConnectionString("data source=(local); initial catalog=nservicebus; integrated security=true");
config.EnableInstallers();
config.SendFailedMessagesTo("error");
config.EnableOutbox();
var endpoint = await Endpoint.Start(config);
Console.WriteLine("Press <enter> to exit");
Console.ReadLine();
await endpoint.Stop();
}
static async Task StartFrontend()
{
var config = new EndpointConfiguration("Frontend");
config.UseTransport<MsmqTransport>();
var persistence = config.UsePersistence<NHibernatePersistence>();
persistence.ConnectionString("data source=(local); initial catalog=nservicebus; integrated security=true");
config.EnableInstallers();
config.SendFailedMessagesTo("error");
config.EnableOutbox();
config.MakeInstanceUniquelyAddressable("ABC");
var endpoint = await Endpoint.Start(config);
Console.WriteLine("Press <enter> to exit");
Console.ReadLine();
await endpoint.Stop();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment