Skip to content

Instantly share code, notes, and snippets.

@SzymonPobiega
Created November 6, 2018 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SzymonPobiega/ac1a3f7e0f9f65c8907df3220740d815 to your computer and use it in GitHub Desktop.
Save SzymonPobiega/ac1a3f7e0f9f65c8907df3220740d815 to your computer and use it in GitHub Desktop.
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