//create messaging endpoint private static async Task Main() { Console.Title = "ClientUI"; //EndpointConfiguration class defintes all settings which determines how endpoint operates //string ClientUI is endpoint name var endpointConfiguration = new EndpointConfiguration("ClientUI"); // //transport is a setting which NServiceBus uses to send and receives messages // var transport = endpointConfiguration.UseTransport<LearningTransport>(); //MSMQ does not support natively Publish/Subscribe var transport = endpointConfiguration.UseTransport <MsmqTransport>(); //message subscription info stored in memory instead endpointConfiguration.UsePersistence <InMemoryPersistence>(); //error queue specified endpointConfiguration.SendFailedMessagesTo("error"); //creates message queues required by endpoints endpointConfiguration.EnableInstallers(); //establises commands of type PlaceOrder should be sent to the Sales endpoint var routing = transport.Routing(); routing.RouteToEndpoint(typeof(PlaceOrder), "Sales"); endpointConfiguration.UseSerialization <JsonSerializer>(); //starts endpoint var endpointInstance = await Endpoint.Start(endpointConfiguration) .ConfigureAwait(false); await RunLoop(endpointInstance) .ConfigureAwait(false); //endpoint runs until user presses enter and then stops await endpointInstance.Stop() .ConfigureAwait(false); }