Exemplo n.º 1
0
        public void Customize(EndpointConfiguration endpointConfiguration)
        {
            Log.Info("Customize...");

            var container = ContainerSetup.Create();

            var licensePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\..\\..\\License.xml");

            endpointConfiguration.LicensePath(licensePath);
            endpointConfiguration.UseSerialization <JsonSerializer>();
            endpointConfiguration.Recoverability().Delayed(c => c.NumberOfRetries(0));
            endpointConfiguration.UseContainer <AutofacBuilder>(c => c.ExistingLifetimeScope(container));

            var routing = endpointConfiguration.UseTransport <MsmqTransport>()
                          .ConnectionString("deadLetter=false;journal=false")
                          .Routing();

            routing.RegisterPublisher(typeof(OrderSubmittedEvent), "Divergent.Sales");

            endpointConfiguration.UsePersistence <NHibernatePersistence>()
            .ConnectionString(ConfigurationManager.ConnectionStrings["Divergent.Finance"].ToString());

            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.AuditProcessedMessagesTo("audit");

            ConventionsBuilder conventions = endpointConfiguration.Conventions();

            conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("Divergent") && t.Namespace.EndsWith("Commands") && t.Name.EndsWith("Command"));
            conventions.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("Divergent") && t.Namespace.EndsWith("Events") && t.Name.EndsWith("Event"));

            endpointConfiguration.EnableInstallers();
        }
Exemplo n.º 2
0
        public void Customize(EndpointConfiguration endpointConfiguration)
        {
            Log.Info("Customize...");

            var container = ContainerSetup.Create();

            endpointConfiguration.UseSerialization <JsonSerializer>();
            endpointConfiguration.DisableFeature <SecondLevelRetries>();
            endpointConfiguration.UseContainer <AutofacBuilder>(c => c.ExistingLifetimeScope(container));
            endpointConfiguration.UseTransport <MsmqTransport>()
            .ConnectionString("deadLetter=false;journal=false");
            //endpointConfiguration.UsePersistence<NHibernatePersistence>()
            //    .ConnectionString(ConfigurationManager.ConnectionStrings["Divergent.Finance"].ToString());
            endpointConfiguration.UsePersistence <InMemoryPersistence>();

            endpointConfiguration.SendFailedMessagesTo("error");
            endpointConfiguration.AuditProcessedMessagesTo("audit");

            ConventionsBuilder conventions = endpointConfiguration.Conventions();

            conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("Divergent") && t.Namespace.EndsWith("Commands") && t.Name.EndsWith("Command"));
            conventions.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("Divergent") && t.Namespace.EndsWith("Events") && t.Name.EndsWith("Event"));

            endpointConfiguration.EnableInstallers();
        }