public ActorSynchronizedRepository(DatabaseApplicationContext databaseContext,
                                    MessageBus.MessageBroker messageBroker,
                                    ILogger <IEventSynchronizer <Actor, ActorEventEntity> > logger,
                                    ServerDescriptor descriptor) : base(
         databaseContext, messageBroker, logger, descriptor)
 {
 }
Пример #2
0
        static void Main(string[] args)
        {
            _messageBroker = new MessageBus.MessageBroker(Environment.GetEnvironmentVariable("MessageBrokerConnectionString"));
            _httpListener  = new HttpListener();
            _httpListener.Prefixes.Add(Environment.GetEnvironmentVariable("LoadBalancerListenUrl"));
            _connectionMultiplexer = ConnectionMultiplexer.Connect(Environment.GetEnvironmentVariable("RedisHost"));


            var loadDistrubution     = GetLoadDistribution();
            var loadBalancerListener = new LoadBalancerListener(_httpListener, loadDistrubution, _connectionMultiplexer);

            _messageBroker.Subscribe <ServerUpEvent>("server", serverUpEvent =>
            {
                Console.WriteLine($"Server up {serverUpEvent.Url}");
                loadDistrubution.Add(new Uri(serverUpEvent.Url));
            });
            loadBalancerListener.Listen();
        }
Пример #3
0
 private static void Register <T, TEvent>(IEventSynchronizer <T, TEvent> eventSynchronizer, MessageBus.MessageBroker broker)
     where T : IEntity where TEvent : IEventEntity
 {
     broker.Subscribe <EntityInsertEvent <TEvent> >(eventSynchronizer.InsertQueue, eventSynchronizer.OnInsertEvent);
     broker.Subscribe <EntityUpdatedEvent <TEvent> >(eventSynchronizer.UpdateQueue, eventSynchronizer.OnUpdateEvent);
     broker.Subscribe <EntityDeletedEvent>(eventSynchronizer.DeleteQueue, eventSynchronizer.OnDeleteEvent);
 }