Esempio n. 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;
        }
        public XXXServiceLibraryConfiguration()
        {
            try
            {
                _currentConfig = LoadCurrentConfig();
                LoadCustomSettings();
            }

            catch (Exception anyException)
            {
                Trace.TraceError("Error initializing configuration in HERBProject.Impl.ServiceLibrary.Configuration.XXXServiceLibraryConfiguration: " + anyException.Message);
                throw new ConfigurationInitializationException("Error initializing configuration in HERBProject.Impl.ServiceLibrary.Configuration.XXXServiceLibraryConfiguration: " + anyException.Message, anyException);
            }
        }
Esempio n. 3
0
        private VuelingEnvironment LoadCurrentConfig()
        {
            if (!VuelingEnvironment.IsInitialized)
            {
                var errorMessage = string.Format("VuelingEnvironment not initialized in {0}.", GetType().FullName);

                Trace.TraceError(errorMessage);
                throw new ConfigurationInitializationException(errorMessage);
            }

            VuelingEnvironment.InitializeLibrary("Vueling.XXX.Library");

            return(VuelingEnvironment.Current);
        }
Esempio n. 4
0
        private VuelingEnvironment LoadCurrentConfig()
        {
            if (!VuelingEnvironment.IsInitialized)
            {
                var errorMessage = string.Format("VuelingEnvironment not initialized in {0}.",
                                                 this.GetType().FullName);

                Trace.TraceError(errorMessage);
                throw new ConfigurationInitializationException(errorMessage);
            }

            VuelingEnvironment.InitializeLibrary("Poc.Rabbitmq.Balancer.WindowsService");

            return(VuelingEnvironment.Current);
        }
Esempio n. 5
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);
            }
        }
Esempio n. 7
0
        public Configuration()
        {
            try
            {
                _currentConfig = LoadCurrentConfig();
                LoadCustomSettings();
            }
            catch (ConfigurationInitializationException) { throw; }
            catch (Exception ex)
            {
                var errorMessage = string.Format("Error initializing configuration in {0}: {1}. {2}",
                                                 this.GetType().FullName, ex.Message, ex);

                Trace.TraceError(errorMessage);
                throw new ConfigurationInitializationException(errorMessage);
            }
        }
Esempio n. 8
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"
            }
                );
        }
        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);
                }
            }
        }