static async Task Main() { // Create service collection ServiceCollection serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); //Set console title Console.Title = EndpointName; //Configure logging LogManager.Use <DefaultFactory>() .Level(LogLevel.Info); log = LogManager.GetLogger <Program>(); //Configure NSB Endpoint EndpointConfiguration endpointConfiguration = EndpointConfigurations.ConfigureNSB(serviceCollection, EndpointName); endpointConfiguration.AuditSagaStateChanges(serviceControlQueue: "particular.servicecontrol"); //Start NSB Endpoint EndpointInstance = await Endpoint.Start(endpointConfiguration); //Support Graceful Shut Down of NSB Endpoint in PCF AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; log.Info("ENDPOINT READY"); Console.Read(); }
static async Task Main() { // Create service collection ServiceCollection serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); //Set console title Console.Title = EndpointName; //Configure logging LogManager.Use <DefaultFactory>() .Level(LogLevel.Info); log = LogManager.GetLogger <Program>(); //Configure NSB Endpoint EndpointConfiguration endpointConfiguration = EndpointConfigurations.ConfigureNSB(serviceCollection, EndpointName); //Start NSB Endpoint EndpointInstance = await Endpoint.Start(endpointConfiguration); //Support Graceful Shut Down of NSB Endpoint in PCF AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; log.Info("ENDPOINT READY"); while (true) { var guid = Guid.NewGuid(); log.Info($"Requesting to get data by id: {guid:N}"); ProcessSale message = GenerateMessage(guid); //Send a message to a specific queue await EndpointInstance.Send("Sales", message); // Sleep as long as you need. Thread.Sleep(1000); } }
static async Task Main() { // Create service collection ServiceCollection serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); //Set console title Console.Title = EndpointName; //Configure logging LogManager.Use <DefaultFactory>() .Level(LogLevel.Info); log = LogManager.GetLogger <Program>(); //Configure NSB Endpoint EndpointConfiguration endpointConfiguration = EndpointConfigurations.ConfigureNSB(serviceCollection, EndpointName); var transport = endpointConfiguration.UseTransport <MsmqTransport>(); var routing = transport.Routing(); routing.RegisterPublisher( assembly: typeof(IRecievedNewOrder).Assembly, publisherEndpoint: "Sales"); //Start NSB Endpoint EndpointInstance = await Endpoint.Start(endpointConfiguration); //Support Graceful Shut Down of NSB Endpoint in PCF AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; log.Info("ENDPOINT READY"); Console.Read(); }