コード例 #1
0
        static ServiceLocator()
        {
            if (!VuelingEnvironment.IsInitialized)
            {
                VuelingEnvironment.InitializeCurrentForApplication(applicationId);
            }

            var registerDefinition = new RegisterDefinition
            {
                ExecutingAssembly           = Assembly.Load("Vueling.XXX.Library"),
                ConfigurationLifetimeScope  = LifetimeScopes.InstancePerLifetimeScope,
                DbContextLifetimeScope      = LifetimeScopes.InstancePerLifetimeScope,
                DefaultServiceLifetimeScope = LifetimeScopes.InstancePerDependency,
                InstanciateSingleInstanceServicesAfterRegister = true,
#if (DEBUG)
                InstanciateAllServicesAfterRegister = true,
#endif
                AdditionalEntryServices = new List <Type>
                {
                    typeof(Vueling.XXX.Library.InfrastructureContracts.IUnitOfWorkBooking),
                }
            };

            var registrator = new Vueling.XXX.EF.DB.Infrastructure.IntegrationTest.Helpers.ReflectionRegistrator();

            registrator.RegisterDependencies(registerDefinition);

            container = registrator.Container;
        }
コード例 #2
0
        static void Main(string[] args)
        {
            VuelingEnvironment.InitializeCurrentForApplication("Vueling.Contingency.CrmNotifier.WindowsService");
            EndpointConfiguration.SetGetRabbitMqConnections();
            var service = MessageConsumerBuilder.RegisterMessageHandlers(
                typeof(CrmNotifierRequestHandler))
                          .RegisterCustomisations()
                          .Build();

            Trace.TraceInformation("Service created");
#if (!DEBUG)
            System.ServiceProcess.ServiceBase.Run(service);
#else
            service.Start();
#endif
        }
        void Application_Start(object sender, EventArgs e)
        {
            try
            {
                VuelingEnvironment.InitializeCurrentForApplication(ApplicationId);

                RegisterDependencies();

                RegisterRoutes();
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
                HttpRuntime.UnloadAppDomain(); // Make sure we try to run Application_Start again next request
                throw new AppStartException(ex);
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            VuelingEnvironment.InitializeCurrentForApplication("Poc.Rabbitmq.Balancer.WindowsService");
            EndpointConfiguration.SetGetRabbitMqConnections();

            var container = MessageConsumerBuilder.RegisterMessageHandlers(
                typeof(BookingBalancerHandler))
                            .RegisterCustomisations()
                            .BuildDebug();

            var handleEvent = EndpointResolver.Container.Resolve <IHandleEvent <BookingBalancerRequest> >() as BookingBalancerHandler;

            handleEvent.Handle(
                new BookingBalancerRequest()
            {
                RecordLocator      = "PJV74B",
                Email              = "*****@*****.**",
                Amount             = 99.96M,
                ProcessType        = "CancelCreditShell",
                RefundCurrencyCode = "EUR",
                RefundType         = "Percentage"
            }
                );
        }
コード例 #5
0
        static void Main(string[] args)
        {
            VuelingEnvironment.InitializeCurrentForApplication("Vueling.Contingency.CrmNotifier.WindowsService");
            EndpointConfiguration.SetGetRabbitMqConnections();
            var buildDebug = MessageConsumerBuilder.RegisterMessageHandlers(
                typeof(CrmNotifierRequestHandler))
                             .RegisterCustomisations()
                             .BuildDebug();

            Trace.TraceInformation("Service created");
            try
            {
                var handleEvent = EndpointResolver.Container.Resolve <IHandleEvent <CrmNotifierRequest> >() as CrmNotifierRequestHandler;
                handleEvent.Handle(new CrmNotifierRequest()
                {
                    Result              = false,
                    ExternalId          = "Test",
                    ExpirationDate      = DateTime.Now,
                    Currency            = "EUR",
                    ErrorMessage        = "no anencgdd",
                    Amount              = 100.00M,
                    ErrorCode           = "fsfdff",
                    RecordLocator       = "VY4443",
                    BookingId           = "13241241",
                    ContactFirstname    = "Test",
                    ContactLastname     = "Test",
                    CultureCode         = "es-ES",
                    Email               = "*****@*****.**",
                    ProcessType         = "CancelCreditShell",
                    RefundCurrencyCode  = "EUR",
                    RefundType          = "Percentage",
                    RefundValue         = 0.00M,
                    OriginalAmount      = 100.00M,
                    FlightProcessedList = new List <FlightProcessedRequest>()
                    {
                        new FlightProcessedRequest()
                        {
                            CarrierCode         = "Test",
                            InventoryLegId      = "1234567",
                            FlightDepartureIATA = "Test",
                            FlightArrivalIATA   = "Test",
                            FlightDateLT        = DateTime.Now,
                            FlightNumber        = "Test",
                        },
                        new FlightProcessedRequest()
                        {
                            CarrierCode         = "Test2",
                            InventoryLegId      = "1234567",
                            FlightDepartureIATA = "Test2",
                            FlightArrivalIATA   = "Test2",
                            FlightDateLT        = DateTime.Now,
                            FlightNumber        = "Test2",
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                try
                {
                    var errorMessage =
                        $@"Principal Error in: Test, method : Handle, booking: Test, innerExceptionType: {ex.GetType()}, innerExceptionMessage: {ex.Message}";

                    Trace.TraceError(errorMessage, ex);
                }
                catch (Exception exInner)
                {
                    Console.WriteLine(exInner.Message);
                }
            }
        }