コード例 #1
0
 public UsersIntegrationService(
     IScopedServiceFactory <FileDbContext> dbContextScopeFactory,
     IHttpClientWrapper httpClientWrapper,
     IEventBusWrapper eventBus,
     ILoggerFactory loggerFactory)
 {
     this.dbContextScopeFactory = dbContextScopeFactory;
     this.httpClientWrapper     = httpClientWrapper;
     this.eventBus = eventBus;
     this.logger   = loggerFactory.CreateLogger <UsersIntegrationService>();
 }
コード例 #2
0
 public FileLockExpiryNotificator(IEventBusWrapper eventBus, ILoggerFactory loggerFactory)
 {
     this.eventBus            = eventBus;
     this.logger              = loggerFactory.CreateLogger <FileLockExpiryNotificator>();
     this.expiryDatesByFileId = new SimplePriorityQueue <FileLockExpiryInfo, DateTime>();
     this.timer = new Timer
     {
         AutoReset = true,
         Interval  = int.MaxValue,
     };
     this.timer.Elapsed += ProcessLockExpiry;
     this.timer.Start();
 }
コード例 #3
0
        public FileLockChangedNotificator(
            IEventBusWrapper eventBus,
            IClientGroupsManager clientGroupsManager,
            ILoggerFactory loggerFactory)
        {
            this.eventBus            = eventBus;
            this.clientGroupsManager = clientGroupsManager;
            this.logger = loggerFactory.CreateLogger <FileLockChangedNotificator>();

            eventBus.Subscribe <FileLockChangedEvent, FileLockChangedMessage>(message =>
            {
                logger.LogTrace("Event: " + message.FileId);
                clientGroupsManager.SendToGroup(message.FileId, message);
            });
        }
コード例 #4
0
 public static void Subscribe <TEvent, TMessage>(this IEventBusWrapper @this,
                                                 Action <TMessage> messageHandler) where TEvent : IEvent <TMessage>
 {
     @this.Subscribe(new EventHandlerAdapter <TEvent, TMessage>(messageHandler));
 }