/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { var baseConfig = EventStoreConfig.GetConfig(); var promotionsConfig = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user1Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user2Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); StatsMonitor = new StatsMonitor(); EventSystem.Create( MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessor("user1", user1Config, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <UserManagement>), MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessor("user2", user2Config, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <UserManagement>), MicroserviceFactory <Promotions, PromotionsHandler> . CreateEventProcessor("promo", promotionsConfig, null, plugin, persistIncomingEvents, false, SetupInMemoryPersistence <Promotions>, (consumer, serializer, payload) => { var e = serializer.Deserialize <IEvent>(payload); if (e is FreePointsRewardedToUser) { return(false); } return(true); })); }
/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { var baseConfig = EventStoreConfig.GetConfig(); var promotionsConfig = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user1Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); var user2Config = new DummyEventStoreConfig(DbManager.FixedConnectionstring, baseConfig); //SingleMicroserviceInitializer.Run( // container, () => MicroserviceFactory<UserManagement, UserManagementHandler> // .CreateEventProcessorWithApp<UserAppService>(container, userConfig), // !_isConsoleApp); MultiMicroserviceInitializer.Run(container, () => { var services = new List <IMicroservice>(); UserContainer1 = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessorWithApp <UserAppService>("user1", "user1_app", UserContainer1, user1Config, plugin, SetupInMemoryPersistence <UserManagement>)); UserContainer2 = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <UserManagement, UserManagementHandler> .CreateEventProcessorWithApp <UserAppService>("user2", "user2_app", UserContainer2, user2Config, plugin, SetupInMemoryPersistence <UserManagement>)); PromotionsContainer = ContainerFactory.ResolveDependenciesForNewChildContainer(container); services.Add(MicroserviceFactory <Promotions, PromotionsHandler> . CreateEventProcessor("promo", PromotionsContainer, promotionsConfig, plugin, SetupInMemoryPersistence <Promotions>)); return(services); }, false, Program.VerboseIsEnabled); }
public ClientSystem(string userName) { this.container = new UnityContainer(); var config = new EventStoreConfig(userName); SingleMicroserviceInitializer.Run(container: this.container, useSignalRLog: false, microserviceFactory: () => MicroserviceFactory <ItemClient, ItemClientHandler> .CreateEventProcessorWithApp <ItemClientApp>( uniqueName: $"{userName}", appUniqueName: $"{userName}App", container: this.container, eventStoreConfig: config, publisherFactory: (streamType, bus, log, dao, eventsToPushMaxCount, pollTimeout) => new OcassionallyConnectedPublisher(streamType, bus, log, dao, eventsToPushMaxCount, pollTimeout, "v1", "http://localhost:51343/client-proxy/upload", "123", "OccServer"))); }
/// <summary>Registers the type mappings with the Unity container.</summary> /// <param name="container">The unity container to configure.</param> /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks> public static void RegisterTypes(IUnityContainer container) { var config = new EventStoreConfig(); proxies.Add("OccClient1", new OcassionallyConnectedSource("OccClient1")); proxies.Add("OccClient2", new OcassionallyConnectedSource("OccClient2")); SingleMicroserviceInitializer.Run( container: container, useSignalRLog: true, ocassionallyConnectedSources: proxies.Values.ToList(), microserviceFactory: () => MicroserviceFactory <ItemServer, ItemServerHandler> .CreateEventProcessor( uniqueName: "OccServer", container: container, eventStoreConfig: config)); }