public static void RegisterHandler <TEventType>(this IAfEventHub afEventHub, Action <ILifetimeScope, IAfEvent> action) where TEventType : class, IAfEvent { afEventHub.RegisterHandler <TEventType>( (scope, e, sourceMessage) => { action.Invoke(scope, (TEventType)e); }); }
public async ValueTask StartAsync() { var bkSearchServerMethodInfos = _lpcServer.AddServerInstance(_bkSearcherServer); _logger.LogInformation("There are {Count} method bind to LPCServer: {Names}", bkSearchServerMethodInfos.Count, bkSearchServerMethodInfos.Select(x => x.Name)); var notificationMethodInfos = _lpcServer.AddServerInstance(_notificationRecordServer); _logger.LogInformation("There are {Count} method bind to LPCServer: {Names}", notificationMethodInfos.Count, notificationMethodInfos.Select(x => x.Name)); await _lpcServer.StartAsync(); _afEventHub.RegisterHandler <SmallCacheExpiredEvent>(Action); await _afEventHub.EnsureStartAsync(); }
public async ValueTask StartAsync() { _afEventHub.RegisterHandler <UserClickAfIconEvent>(HandleUserClickAfIconEvent); await _afEventHub.EnsureStartAsync(); }
public static void RegisterHandler <TEventType>(this IAfEventHub afEventHub, Func <TEventType, Task> handler) where TEventType : class, IAfEvent { afEventHub.RegisterHandler <TEventType>((scope, e) => { handler.Invoke((TEventType)e); }); }