示例#1
0
        static void Main(string[] args)
        {
            var runMenu = new UserInterface();

            EscapeSequencer.Install();   //Install sequence parse
            EscapeSequencer.Bold = true; //Brighter colors

            runMenu.MainMenu();
        }
示例#2
0
        private static async Task ConfigureAndSend()
        {
            EscapeSequencer.Install();
            EscapeSequencer.Bold = true;

            var defaultFactory = LogManager.Use <DefaultFactory>();

            defaultFactory.Level(LogLevel.Warn);

            while (true)
            {
                var endpointConfiguration = new EndpointConfiguration("ExemploSaga.Pedidos");

                endpointConfiguration.SendFailedMessagesTo("ExemploSaga.Pedidos.Errors");
                /* Para testes, é possível usar persistencia em memória */
                //endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>();
                //endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>();
                //endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Outbox>();
                //endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.GatewayDeduplication>();
                //endpointConfiguration.UsePersistence<InMemoryPersistence, StorageType.Sagas>();
                endpointConfiguration.UsePersistence <NHibernatePersistence>();

                endpointConfiguration.UseSerialization <JsonSerializer>();
                endpointConfiguration.EnableInstallers();

                endpointConfiguration.SagaPlugin("OpenPlatform.ServiceControl");


                var transport = endpointConfiguration.UseTransport <RabbitMQTransport>();
                transport.ConnectionString("host=localhost");

                var endpoint = await Endpoint.Start(endpointConfiguration).ConfigureAwait(false);

                var adicionarPedido = new AdicionarPedidoCommand(Guid.NewGuid(), "Heber");

                Console.WriteLine($"ENTER para enviar mensagem para pedido {adicionarPedido.Id} - {adicionarPedido.Cliente}");
                Console.ReadLine();

                await endpoint.SendLocal(adicionarPedido);

                Console.WriteLine("Aguardando os handlers... ENTER para finalizar");

                await Task.Delay(300).ConfigureAwait(false);
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            EscapeSequencer.Install();
            EscapeSequencer.Bold = true; //set default bold to On. Actually this will use bright colors. Easier to read

            // simple test
            Console.WriteLine("INFO: ".Yellow() + "Hello".Red() + ", " + "World.".Blue());

            Console.WriteLine("This is rainbow".Rainbow()); // all we need is unicorn :)
            Console.WriteLine("This is zebra".Zebra());     // no worries. A zebra will do

            const string RandomColorLine = "This line will be randomly colored";

            for (int n = 0; n < 5; n++)
            {
                Console.WriteLine(RandomColorLine.CustomSequencer());
            }

            //Console.WriteLine("What color is this?".Reset());
        }
示例#4
0
 // Constructor
 static Logger()
 {
     // Beauty print console colors
     EscapeSequencer.Install();
     EscapeSequencer.Bold = true;
 }
示例#5
0
        static void Main(string[] args)
        {
            EscapeSequencer.Install();
            EscapeSequencer.Bold = true; //set default bold to On. Actually this will use bright colors. Easier to read
            Console.WriteLine("");

            Utilities.ShowIntro();

            bool showFake = false;

            bool showPortfolio = false;
            bool showMarket    = false;

            if (args.Length > 0)
            {
                // rudimentary 'parsing': first pass
                foreach (var item in args)
                {
                    if (item.Trim().ToLower().Equals("portfolio"))
                    {
                        showPortfolio = true;
                    }
                    else if (item == "-fake" || item == "--fake")
                    {
                        showFake = true;
                    }
                    else if (item.Trim().ToLower().Equals("market"))
                    {
                        showMarket = true;
                    }
                }

                var services = new ServiceCollection();

                if (showFake)
                {
                    services.UseFakeServices();
                }
                else
                {
                    services.UseServices();
                }

                var serviceProvider  = services.BuildServiceProvider();
                var servicePortfolio = serviceProvider.GetRequiredService <IBrokerService>();
                var serviceMarket    = serviceProvider.GetRequiredService <IMarketService>();

                if (showPortfolio)
                {
                    var portfolio = PortfolioController.GetPortfolio(servicePortfolio).Result;
                    Utilities.ShowPortfolioToScreen(portfolio);
                }
                else if (showMarket)
                {
                    Utilities.ShowMarket("ar");

                    var market = MarketController.GetMarketAsync(serviceMarket).Result;
                    Utilities.ShowMarketToScreen(market);
                }
                else
                {
                    Utilities.Ccw("Nothing to see here.", ConsoleColor.Cyan, true);
                    Utilities.ShowExit();
                    // Console.ReadKey();
                }
            }
            Utilities.ShowTimestamp();
        }