static async Task Main() { Console.Title = "Router"; #region RouterConfig var routerConfig = new RouterConfiguration("Samples.Router.UpdateAndPublish.Router"); var frontendInterface = routerConfig.AddInterface <SqlServerTransport>("SQL", t => { t.ConnectionString(ConnectionString); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); var backendInterface = routerConfig.AddInterface <LearningTransport>("Learning", t => { }); var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("SQL", "Learning"); staticRouting.AddForwardRoute("Learning", "SQL"); routerConfig.AutoCreateQueues(); #endregion SqlHelper.EnsureDatabaseExists(ConnectionString); var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
static async Task Main() { Console.Title = "Samples.Router.MixedTransports.Router"; #region RouterConfig var routerConfig = new RouterConfiguration("Samples.Router.MixedTransports.Router"); var msmqInterface = routerConfig.AddInterface <MsmqTransport>("MSMQ", t => { }); msmqInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); var rabbitMQInterface = routerConfig.AddInterface <RabbitMQTransport>("RabbitMQ", t => { t.ConnectionString("host=localhost"); t.UseConventionalRoutingTopology(); }); var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("MSMQ", "RabbitMQ"); routerConfig.AutoCreateQueues(); #endregion var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
static async Task Main(string[] args) { Console.Title = "Samples.Azure.ServiceBus.Bridge"; var connectionString = Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"); if (string.IsNullOrWhiteSpace(connectionString)) { throw new Exception("Could not read the 'AzureServiceBus.ConnectionString' environment variable. Check the sample prerequisites."); } #region bridge-general-configuration var bridgeConfiguration = new RouterConfiguration("Bridge"); var azureInterface = bridgeConfiguration.AddInterface <AzureServiceBusTransport>("ASB", transport => { //Prevents ASB from using TransactionScope transport.Transactions(TransportTransactionMode.ReceiveOnly); transport.ConnectionString(connectionString); }); var msmqInterface = bridgeConfiguration.AddInterface <MsmqTransport>("MSMQ", transport => { transport.Transactions(TransportTransactionMode.ReceiveOnly); }); msmqInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); //Configure the host of the MSMQ endpoint msmqInterface.EndpointInstances.AddOrReplaceInstances("publishers", new List <EndpointInstance> { new EndpointInstance("Samples.Azure.ServiceBus.MsmqEndpoint").AtMachine(Environment.MachineName) }); bridgeConfiguration.AutoCreateQueues(); var staticRouting = bridgeConfiguration.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute( incomingInterface: "MSMQ", outgoingInterface: "ASB"); staticRouting.AddForwardRoute( incomingInterface: "ASB", outgoingInterface: "MSMQ"); #endregion #region bridge-execution var bridge = Router.Create(bridgeConfiguration); await bridge.Start().ConfigureAwait(false); Console.WriteLine("Press any key to exit"); Console.ReadKey(); await bridge.Stop().ConfigureAwait(false); #endregion }
private static async Task Main(string[] args) { var config = ConfigurationCreator.GetConfiguration(); var routerName = config["NServiceBus:EndpointName"]; Console.Title = routerName; var routerConfig = new RouterConfiguration(routerName); var staticRouting = routerConfig.UseStaticRoutingProtocol(); RouteFromAzureToAzure(config, routerConfig, staticRouting); // RouteFromLearningToAzure(routerConfig, config, staticRouting); // RouteFromAzureToLearning(routerConfig, config, staticRouting); routerConfig.AutoCreateQueues(); routerConfig.PoisonQueueName = $"{routerName}-poison"; var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
static async Task Main() { Console.Title = "Samples.Router.Sites.RouterB"; var routerConfig = new RouterConfiguration("SiteB"); routerConfig.AddInterface <LearningTransport>("Local", t => { }); routerConfig.AddInterface <MsmqTransport>("Tunnel", t => { }).EnableMessageDrivenPublishSubscribe(new NullSubscriptionStore()); routerConfig.AutoCreateQueues(); #region ConfigureRouterB var routing = routerConfig.UseStaticRoutingProtocol(); routing.AddForwardRoute("Tunnel", "Local"); #endregion var router = Router.Create(routerConfig); await router.Start() .ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop() .ConfigureAwait(false); }
public async Task Start() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .Build(); var routerConfig = new RouterConfiguration(EndpointName); // if we want to change to something other than "poison" // routerConfig.PoisonQueueName = "..." #region Configure WebApi interface var webApiConnectionString = config.GetConnectionString("WebApi"); var webApiInterface = routerConfig.AddInterface <SqlServerTransport>(WebApiInterface, t => { t.ConnectionString(webApiConnectionString); t.DefaultSchema("nsb"); // two connection strings, would be escalated to distributed otherwise t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); #endregion #region Configure backend interface var backendConnectionString = config.GetConnectionString("Nsb"); var backendInterface = routerConfig.AddInterface <SqlServerTransport>(BackendInterface, t => { t.ConnectionString(backendConnectionString); t.DefaultSchema("nsb"); // two connection strings, would be escalated to distributed otherwise t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); #endregion #region Routing var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute(WebApiInterface, BackendInterface); staticRouting.AddForwardRoute(BackendInterface, WebApiInterface); #endregion // TODO comment out routerConfig.AutoCreateQueues(); try { _endpoint = NServiceBus.Router.Router.Create(routerConfig); await _endpoint.Start(); } catch (Exception ex) { FailFast("Failed to start.", ex); } }
static async Task Main(string[] args) { Console.Title = "Samples.Azure.ServiceBus.Bridge"; var connectionString = Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString"); if (string.IsNullOrWhiteSpace(connectionString)) { throw new Exception("Could not read the 'AzureServiceBus.ConnectionString' environment variable. Check the sample prerequisites."); } #region bridge-general-configuration var bridgeConfiguration = new RouterConfiguration("Bridge"); var azureInterface = bridgeConfiguration.AddInterface <AzureServiceBusTransport>("ASB", transport => { //Prevents ASB from using TransactionScope transport.Transactions(TransportTransactionMode.ReceiveOnly); transport.ConnectionString(connectionString); // TODO: ASB requires serializer to be registered. // Currently, there's no way to specify serialization for the bridged endpoints // endpointConfiguration.UseSerialization<T>(); var settings = transport.GetSettings(); var serializer = Tuple.Create(new NewtonsoftSerializer() as SerializationDefinition, new SettingsHolder()); settings.Set("MainSerializer", serializer); var topology = transport.UseEndpointOrientedTopology().EnableMigrationToForwardingTopology(); topology.RegisterPublisher(typeof(OtherEvent), "Samples.Azure.ServiceBus.AsbEndpoint"); }); var msmqInterface = bridgeConfiguration.AddInterface <MsmqTransport>("MSQM", transport => { }); msmqInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); bridgeConfiguration.AutoCreateQueues(); #endregion #region bridge-execution var bridge = Router.Create(bridgeConfiguration); await bridge.Start().ConfigureAwait(false); Console.WriteLine("Press any key to exit"); Console.ReadKey(); await bridge.Stop().ConfigureAwait(false); #endregion }
static async Task Main() { Console.Title = "Switch"; SqlHelper.EnsureDatabaseExists(SwitchConnectionString); SqlHelper.EnsureDatabaseExists(ConnectionStrings.Blue); SqlHelper.EnsureDatabaseExists(ConnectionStrings.Red); SqlHelper.EnsureDatabaseExists(ConnectionStrings.Green); #region SwitchConfig var routerConfig = new RouterConfiguration("Switch"); routerConfig.AddInterface <SqlServerTransport>("Blue", t => { t.ConnectionString(ConnectionStrings.Blue); }); routerConfig.AddInterface <SqlServerTransport>("Red", t => { t.ConnectionString(ConnectionStrings.Red); }); routerConfig.AddInterface <SqlServerTransport>("Green", t => { t.ConnectionString(ConnectionStrings.Green); }); routerConfig.AutoCreateQueues(); #endregion #region SwitchForwarding var staticRouting = routerConfig.UseStaticRoutingProtocol(); //Send all messages to endpoints which name starts with Sales via interface A staticRouting.AddRoute( destinationFilter: (iface, destination) => destination.Endpoint.StartsWith("Red."), destinationFilterDescription: "To Red", gateway: null, iface: "Red"); staticRouting.AddRoute( (iface, destination) => destination.Endpoint.StartsWith("Blue."), "To Blue", null, "Blue"); staticRouting.AddRoute( (iface, destination) => destination.Endpoint.StartsWith("Green."), "To Green", null, "Green"); #endregion var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
static async Task Main() { Console.Title = "Router"; #region RouterConfig var routerConfig = new RouterConfiguration("DomainA-B-Router"); var domainAInterface = routerConfig.AddInterface <SqlServerTransport>("DomainA", t => { t.ConnectionString(ConnectionStrings.DomainA); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); var domainASqlSubscriptionStorage = new SqlSubscriptionStorage(() => new SqlConnection(ConnectionStrings.Router), "DomainA-", new SqlDialect.MsSqlServer(), null); domainAInterface.EnableMessageDrivenPublishSubscribe(domainASqlSubscriptionStorage); var domainBInterface = routerConfig.AddInterface <SqlServerTransport>("DomainB", t => { t.ConnectionString(ConnectionStrings.DomainB); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); var domainBSqlSubscriptionStorage = new SqlSubscriptionStorage(() => new SqlConnection(ConnectionStrings.Router), "DomainB-", new SqlDialect.MsSqlServer(), null); domainBInterface.EnableMessageDrivenPublishSubscribe(domainBSqlSubscriptionStorage); var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("DomainA", "DomainB"); staticRouting.AddForwardRoute("DomainB", "DomainA"); routerConfig.AutoCreateQueues(); #endregion SqlHelper.EnsureDatabaseExists(ConnectionStrings.DomainA); SqlHelper.EnsureDatabaseExists(ConnectionStrings.DomainB); SqlHelper.EnsureDatabaseExists(ConnectionStrings.Router); domainASqlSubscriptionStorage.Install().GetAwaiter().GetResult(); domainBSqlSubscriptionStorage.Install().GetAwaiter().GetResult(); var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
RouterConfiguration PrepareRouterConfiguration(string routerEndpointName, string mainEndpointName, string mainEndpointAddress, Action <TransportExtensions <TOld> > customizeOldTransport, Action <TransportExtensions <TNew> > customizeNewTransport) { var cfg = new RouterConfiguration(routerEndpointName); var newInterface = cfg.AddInterface("New", customizeNewTransport); newInterface.DisableNativePubSub(); //Forward unmodified subscribe messages from migrated subscriber newInterface.AddRule(c => new ForwardSubscribeRule()); //Forward published events from shadow interface to migrated subscriber newInterface.AddRule(c => new ForwardPublishRule(mainEndpointAddress)); var shadowInterface = cfg.AddInterface("Shadow", customizeOldTransport); shadowInterface.DisableMessageDrivenPublishSubscribe(); //Hook up to old Publisher's queue shadowInterface.OverrideEndpointName(mainEndpointName); //Forward subscribe messages shadowInterface.AddRule(c => new ShadowForwardSubscribeRule(c.Endpoint.TransportAddress, c.Endpoint.EndpointName)); //Forward events published by migrated publisher shadowInterface.AddRule(c => new ForwardPublishByDestinationAddressRule()); //Forward subscribes messages from shadow interface to migrated publisher shadowInterface.AddRule(c => new ShadowSubscribeDestinationRule(mainEndpointName)); //Forward sends from shadow interface to migrated receiver shadowInterface.AddRule(c => new ShadowSendDestinationRule(mainEndpointName)); //Removes the destination header shadowInterface.AddRule(_ => new ForwardSendRule()); var staticRouting = cfg.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("New", "Shadow"); staticRouting.AddForwardRoute("Shadow", "New"); cfg.AutoCreateQueues(null); return(cfg); }
static async Task Start() { var sqlConnectionString = SettingsReader <string> .Read("SqlConnectionString", "data source=(local); initial catalog=loadtest; integrated security=true"); var rabbitConnectionString = SettingsReader <string> .Read("RabbitConnectionString", "host=localhost"); var epochSize = SettingsReader <int> .Read("EpochSize", 10000); var routerConfig = new RouterConfiguration("Sender.Router"); routerConfig.AutoCreateQueues(); var deduplicationConfig = routerConfig.ConfigureDeduplication(); #pragma warning disable 618 deduplicationConfig.EnableInstaller(true); #pragma warning restore 618 var linkInterface = routerConfig.AddInterface <RabbitMQTransport>("Rabbit", t => { t.ConnectionString(rabbitConnectionString); t.UseConventionalRoutingTopology(); }); var sqlInterface = routerConfig.AddInterface <SqlServerTransport>("SQL", t => { t.ConnectionString(sqlConnectionString); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); sqlInterface.EnableMessageDrivenPublishSubscribe(new SqlSubscriptionStorage(() => new SqlConnection(sqlConnectionString), "SenderRouter", new SqlDialect.MsSqlServer(), null)); sqlInterface.EnableDeduplication(linkInterface.Name, "Receiver.Router", () => new SqlConnection(sqlConnectionString), epochSize); var routingProtocol = routerConfig.UseStaticRoutingProtocol(); routingProtocol.AddForwardRoute("SQL", "Rabbit", "Receiver.Router"); routerConfig.AddRule(_ => new RandomDuplicator()); var router = Router.Create(routerConfig); await router.Start(); Console.WriteLine("Press <enter> to exit."); Console.ReadLine(); await router.Stop(); }
public void OtherAPIs() { var routerConfig = new RouterConfiguration("MyRouter"); #region recoverability routerConfig.CircuitBreakerThreshold = 20; routerConfig.DelayedRetries = 10; routerConfig.ImmediateRetries = 10; #endregion #region queue-creation routerConfig.AutoCreateQueues(identity: "Bob"); #endregion }
static async Task Main() { Console.Title = "Samples.SqlServer.MultiInstanceBridge"; SqlHelper.EnsureDatabaseExists(SenderConnectionString); SqlHelper.EnsureDatabaseExists(ReceiverConnectionString); SqlHelper.EnsureDatabaseExists(BridgeConnectionString); #region BridgeConfiguration var storage = new SqlSubscriptionStorage( connectionBuilder: () => new SqlConnection(BridgeConnectionString), tablePrefix: "", sqlDialect: new SqlDialect.MsSqlServer(), cacheFor: null); //Ensures all required schema objects are created await storage.Install().ConfigureAwait(false); var bridgeConfig = new RouterConfiguration("Bridge"); var senderInterface = bridgeConfig.AddInterface <SqlServerTransport>("Bridge-Sender", t => t.ConnectionString(SenderConnectionString)); var receiverInterface = bridgeConfig.AddInterface <SqlServerTransport>("Bridge-Receiver", t => t.ConnectionString(ReceiverConnectionString)); senderInterface.UseSubscriptionPersistence(storage); receiverInterface.UseSubscriptionPersistence(storage); bridgeConfig.AutoCreateQueues(); var routeTable = bridgeConfig.UseStaticRoutingProtocol(); routeTable.AddForwardRoute("Bridge-Sender", "Bridge-Receiver"); routeTable.AddForwardRoute("Bridge-Receiver", "Bridge-Sender"); #endregion var bridge = Router.Create(bridgeConfig); await bridge.Start().ConfigureAwait(false); Console.WriteLine("Press any key to exit"); Console.ReadKey(); await bridge.Stop().ConfigureAwait(false); }
static async Task Main() { Console.Title = "MSMQ_SQL_Router"; var routerConfig = new RouterConfiguration("MSMQ_SQL_Router"); var msmqInterface = routerConfig.AddInterface <MsmqTransport>("MSMQ", t => { }); msmqInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); var cs = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=NSB_MSMQ_SQL_Router;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; var sqlServerInterface = routerConfig.AddInterface <SqlServerTransport>("SqlServer", t => { t.ConnectionString(cs); }); sqlServerInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("MSMQ", "SqlServer"); staticRouting.AddForwardRoute("SqlServer", "MSMQ"); routerConfig.AutoCreateQueues(); var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
static async Task Main() { Console.Title = "Samples.Router.MixedTransports.Router"; #region RouterConfig var routerConfig = new RouterConfiguration("Samples.Router.MixedTransports.Router"); var msmqInterface = routerConfig.AddInterface <SqlServerTransport>("MSMQ", t => { t.ConnectionString("Data Source=(localdb)\\MSSQLLocalDB;Integrated Security=True;Initial Catalog=NserviceBusStorage;Application Name=NServiceBus;"); }); msmqInterface.EnableMessageDrivenPublishSubscribe(new InMemorySubscriptionStorage()); var rabbitMQInterface = routerConfig.AddInterface <RabbitMQTransport>("RabbitMQ", t => { t.ConnectionString("host=localhost"); t.UseConventionalRoutingTopology(); }); var staticRouting = routerConfig.UseStaticRoutingProtocol(); staticRouting.AddForwardRoute("MSMQ", "RabbitMQ"); staticRouting.AddForwardRoute("RabbitMQ", "MSMQ"); routerConfig.AutoCreateQueues(); #endregion var router = Router.Create(routerConfig); await router.Start().ConfigureAwait(false); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await router.Stop().ConfigureAwait(false); }
public static async Task <RouterConfiguration> Prepare(string sqlConnectionString, string routerName) { var otherRouters = allRouters.Except(new[] { routerName }).ToArray(); var sqlSubscriptionStorage = new SqlSubscriptionStorage(() => new SqlConnection(sqlConnectionString), $"{routerName}-SQL", new SqlDialect.MsSqlServer(), null); var backplaneSubscriptionStorage = new SqlSubscriptionStorage(() => new SqlConnection(sqlConnectionString), $"{routerName}-Backplane", new SqlDialect.MsSqlServer(), null); #region RouterConfig var routerConfig = new RouterConfiguration(routerName); var sqlInterface = routerConfig.AddInterface <SqlServerTransport>("SQL", t => { t.ConnectionString(sqlConnectionString); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); sqlInterface.EnableMessageDrivenPublishSubscribe(sqlSubscriptionStorage); var backplaneInterface = routerConfig.AddInterface <RabbitMQTransport>("Backplane", t => { t.ConnectionString("host=localhost"); t.UseConventionalRoutingTopology(); }); backplaneInterface.EnableMessageDrivenPublishSubscribe(backplaneSubscriptionStorage); backplaneInterface.DisableNativePubSub(); routerConfig.AutoCreateQueues(); #pragma warning disable 618 routerConfig.ConfigureDeduplication().EnableInstaller(true); #pragma warning restore 618 #endregion if (enableRandomDuplication) { //Randomly duplicate messages sent to the backplane routerConfig.AddRule(c => new RandomDuplicator(c.Endpoint), c => c.InterfaceName == "Backplane"); } if (enableDeduplication) { #region Deduplication foreach (var router in otherRouters) { sqlInterface.EnableDeduplication("Backplane", router, () => new SqlConnection(sqlConnectionString), 10); } #endregion } #region RoutingTopology var staticRouting = routerConfig.UseStaticRoutingProtocol(); //Forward messages coming from local SQL based on the endpoint name prefix foreach (var router in otherRouters) { staticRouting.AddRoute( destinationFilter: (@interface, dest) => { return(@interface == "SQL" && dest.Endpoint != null && dest.Endpoint.StartsWith(router)); }, destinationFilterDescription: $"To {router}", gateway: router, iface: "Backplane"); } //Forward messages coming from backplane to local SQL staticRouting.AddRoute((@interface, dest) => @interface == "Backplane", "To local", null, "SQL"); #endregion await sqlSubscriptionStorage.Install().ConfigureAwait(false); await backplaneSubscriptionStorage.Install().ConfigureAwait(false); return(routerConfig); }
static async Task Start() { Metric.Config.WithReporting(r => { r.WithCSVReports(".", TimeSpan.FromSeconds(5)); }); var senderConfig = new EndpointConfiguration("Sender"); senderConfig.UseSerialization <NewtonsoftSerializer>(); senderConfig.SendFailedMessagesTo("error"); senderConfig.EnableInstallers(); senderConfig.UsePersistence <InMemoryPersistence>(); senderConfig.RegisterComponents(c => c.RegisterSingleton(new LoadGenerator(GenerateMessages, 5000, 10000))); var senderTransport = senderConfig.UseTransport <SqlServerTransport>(); senderTransport.ConnectionString(ConnectionString); senderTransport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); var senderRouterConnector = senderTransport.Routing().ConnectToRouter("Router"); senderRouterConnector.RouteToEndpoint(typeof(MyMessage), "Receiver"); senderTransport.Routing().RouteToEndpoint(typeof(MyMessage), "Receiver"); var routerConfig = new RouterConfiguration("Router"); routerConfig.AutoCreateQueues(); routerConfig.AddInterface <SqlServerTransport>("SQL", t => { t.ConnectionString(ConnectionString); t.Transactions(TransportTransactionMode.SendsAtomicWithReceive); }); routerConfig.AddInterface <RabbitMQTransport>("Rabbit", t => { t.ConnectionString("host=localhost"); t.UseConventionalRoutingTopology(); }); var routingProtocol = routerConfig.UseStaticRoutingProtocol(); routingProtocol.AddForwardRoute("SQL", "Rabbit"); routingProtocol.AddForwardRoute("Rabbit", "SQL"); routerConfig.ConfigureDeduplication(d => { d.EpochSize(1000); d.ConnectionFactory(() => new SqlConnection(ConnectionString)); d.AddOutgoingLink("Rabbit", "Receiver"); }); var receiverConfig = new EndpointConfiguration("Receiver"); receiverConfig.UseSerialization <NewtonsoftSerializer>(); receiverConfig.SendFailedMessagesTo("error"); receiverConfig.EnableInstallers(); receiverConfig.UsePersistence <InMemoryPersistence>(); receiverConfig.EnableFeature <ReporterFeature>(); //var receiverTransport = receiverConfig.UseTransport<RabbitMQTransport>(); //receiverTransport.ConnectionString("host=localhost"); //receiverTransport.UseConventionalRoutingTopology(); var receiverTransport = receiverConfig.UseTransport <SqlServerTransport>(); receiverTransport.ConnectionString(ConnectionString); receiverTransport.Transactions(TransportTransactionMode.SendsAtomicWithReceive); //var receiverRouterConnector = receiverTransport.Routing().ConnectToRouter("Router"); //receiverRouterConnector.RouteToEndpoint(typeof(ProcessingReport), "Sender"); receiverTransport.Routing().RouteToEndpoint(typeof(ProcessingReport), "Sender"); //var router = Router.Create(routerConfig); //await router.Start(); sender = await Endpoint.Start(senderConfig); var receiver = await Endpoint.Start(receiverConfig); Console.WriteLine("Press <enter> to exit"); Console.ReadLine(); await sender.Stop(); await receiver.Stop(); //await router.Stop(); }