Beispiel #1
0
        static void Main(string[] args)
        {
            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStoreSubscriptionEndpoint eventStoreEndpoint = EventStoreSubscriptionEndpoint
                                                                .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <PolicyBound>())
                                                                .WithSqlDatabaseEventIndexStorage();

            MessagingFramework.Bootstrap()
            .SetupDataConnectivity().WithSqlConnection()
            .SetupMessaging()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .ConfigureMessageRouting().Incoming.ForEvents.Handle <PolicyBound>().With <PolicyBoundHandler>()
            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving(OnError);
            MessageReceivingContext.Events.Subscribe(PolicyEventStreamId.Parse("EventIndexStorageExample"));

            Console.WriteLine("I Am SubscriberWithLocalEventIndexStorage");
            Console.ReadLine();

            MessageReceivingContext.MessageReceiver.StopReceiving();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStorePersistentSubscriptionEndpoint eventStoreEndpoint = EventStorePersistentSubscriptionEndpoint
                                                                          .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                          .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                          .WithBufferSizeOf(1)
                                                                          .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <PolicyBound>());

            MessagingFramework.Bootstrap()
            .SetupDataConnectivity().WithSqlConnection()
            .SetupMessaging()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .ConfigureMessageRouting().Incoming.ForEvents.Handle <PolicyBound>().With <PolicyBoundHandler>()
            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving(OnError);
            MessageReceivingContext.Events.Subscribe(TenantPolicyEventStreamGroup.Parse("Tenant1"));

            Console.WriteLine("I Am CompetingConsumerSubscriber2");
            Console.ReadLine();

            MessageReceivingContext.MessageReceiver.StopReceiving();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var container = new IocContainer();

            container.RegisterInstance <IThirdPartyLibrary, ThirdPartyLibrary>();

            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStoreSubscriptionEndpoint eventStoreEndpoint = EventStoreSubscriptionEndpoint
                                                                .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <PolicyBound>())
                                                                .WithInMemoryEventIndexStorage();

            MessagingFramework.Bootstrap()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .ConfigureMessageRouting().Incoming.ForEvents.Handle <PolicyBound>().With(container.Resolve <PolicyBoundHandler>())
            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving(OnError);
            MessageReceivingContext.Events.Subscribe(PolicyEventStreamId.Parse("ContainerExample"));

            Console.WriteLine("I Am Subscriber");
            Console.ReadLine();

            MessageReceivingContext.MessageReceiver.StopReceiving();
        }
        static void Main(string[] args)
        {
            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStoreSubscriptionEndpoint eventStoreEndpoint = EventStoreSubscriptionEndpoint
                                                                .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <AccountCredited>())
                                                                .WithInMemoryEventIndexStorage();

            MessagingFramework.Bootstrap()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .ConfigureMessageRouting()
            .Incoming.ForEvents
            .Handle <AccountCredited>().With <AccountCreditedHandler>()
            .Handle <AccountDebited>().With <AccountDebitedHandler>()
            .Handle <AccountOverdraftLimitReached>().With <AccountOverdraftLimitReachedHandler>()
            .Handle <AccountBalanceLimitReached>().With <AccountBalanceLimitReachedHandler>()
            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving((ex, message) => Console.WriteLine(ex.Message));
            MessageReceivingContext.Events.Subscribe("bankaccounts");

            Console.WriteLine("I am the subscriber. Press Enter to exit");
            Console.ReadLine();

            MessageReceivingContext.Events.Unsubscribe("bankaccounts");
            MessageReceivingContext.MessageReceiver.StopReceiving();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStoreSubscriptionEndpoint eventStoreEndpoint = EventStoreSubscriptionEndpoint
                                                                .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                .WithEventTypeFromNameResolution(EventTypeFromNameResolver.FromTypesFromAssemblyContaining <PolicyBound>())
                                                                .WithInMemoryEventIndexStorage();

            MessagingFramework.Bootstrap()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .ConfigureMessageRouting()
            .Incoming.ForEvents
            .Handle <PolicyBound>().With(new PolicyBoundHandler())
            .Internal.ForCommands
            .Handle <AddPolicyHeader>().With <AddPolicyHeaderHandler>()
            .Handle <AddPolicyLines>().With <AddPolicyLinesHandler>()
            .Handle <AddActivity>().With <AddActivityHandler>()

            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving(OnError);
            MessageReceivingContext.Events.Subscribe(PolicyEventStreamId.Parse("Tenant1"));

            Console.WriteLine("I Am Subscriber");
            Console.ReadLine();

            MessageReceivingContext.MessageReceiver.StopReceiving();
        }
        static void Main()
        {
            HostFactory.Run(configurator =>
            {
                var container = new IocContainer(t => t.NameInCSharp());

                var eventSubscriptionConfig = EventStoreSubscriptionConfiguration.FromAppConfig();

                var eventStoreUrl = EventStoreUrl.Parse(eventSubscriptionConfig.Url);

                var eventStoreUserCredentials = EventStoreUserCredentials.Parse(
                    eventSubscriptionConfig.UserCredentials.User,
                    eventSubscriptionConfig.UserCredentials.Password);

                var eventTypeResolution = EventTypeFromNameResolver.FromTypesFromAssemblyContaining <NewRiskItemMapped>();

                var eventStoreEndpoint = EventStoreEndpoint
                                         .OnUrl(eventStoreUrl)
                                         .WithCredentials(eventStoreUserCredentials)
                                         .WithEventTypeFromNameResolution(eventTypeResolution);

                var eventStoreSubscriptionEndpoint = EventStoreSubscriptionEndpoint
                                                     .ListenTo(eventStoreUrl)
                                                     .WithCredentials(eventStoreUserCredentials)
                                                     .WithEventTypeFromNameResolution(eventTypeResolution)
                                                     .WithSqlDatabaseEventIndexStorage();

                Bootstrap.Application()
                .ResolveReferencesWith(container)
                .SetupDataConnectivity().WithSqlConnection()
                .SetupMessaging()
                .ConfigureSagas().WithDatabasePersistence()
                .ConfigureEventStoreEndpoint(eventStoreEndpoint)
                .ConfigureReceivingEndpoint(eventStoreSubscriptionEndpoint)
                .ConfigureMessageRouting().WireUpRouting()
                .Initialise();

                Trace.TraceInformation(
                    "Data warehouse service has started up and the types registered into the container are {0}{1}",
                    Environment.NewLine,
                    container.Describe());

                configurator.Service <DataWarehouseController>(s =>
                {
                    s.ConstructUsing(name => container.Resolve <DataWarehouseController>());
                    s.WhenStarted(c => c.Start());
                    s.WhenStopped(c => c.Stop());
                });

                configurator.RunAsLocalSystem();
                configurator.SetDescription("Applied Systems Data Warehouse Service");
                configurator.SetDisplayName("Applied Systems Data Warehouse Service");
                configurator.SetServiceName("Applied Systems Data Warehouse Service");
            });
        }
        static void Main(string[] args)
        {
            var eventStoreConfiguration = EventStoreSubscriptionConfiguration.FromAppConfig();

            EventStoreSubscriptionEndpoint eventStoreEndpoint = EventStoreSubscriptionEndpoint
                                                                .ListenTo(EventStoreUrl.Parse(eventStoreConfiguration.Url))
                                                                .WithCredentials(EventStoreUserCredentials.Parse(eventStoreConfiguration.UserCredentials.User, eventStoreConfiguration.UserCredentials.Password))
                                                                .WithEventTypeFromNameResolution(EventTypeFromNameResolver.Default())
                                                                .WithInMemoryEventIndexStorage();

            MessagingFramework.Bootstrap()
            .ConfigureReceivingEndpoint(eventStoreEndpoint)
            .RegisterIncomingPipelineComponent(new EventForwarderPipe(new CustomEventProcessor()))
            .Initialise();

            MessageReceivingContext.MessageReceiver.StartReceiving(OnError);
            MessageReceivingContext.Events.Subscribe("CustomPipelineExample1");

            Console.WriteLine("I Am Subscriber");
            Console.ReadLine();

            MessageReceivingContext.MessageReceiver.StopReceiving();
        }