public IDisposable RegisterNotificationHandler <TNotification>(Action <TNotification> handler) where TNotification : INotification { var subscription = _asyncMessageBus.Subscribe(handler); return(SubscriptionTracker <TNotification> .Track(subscription)); }
public IDisposable RegisterRequestHandler <TRequest>(Action <TRequest> handler) where TRequest : IRequest { SubscriptionTracker <TRequest> .ThrowIfHasSubscribers(); var subscription = _asyncMessageBus.Subscribe(handler); return(SubscriptionTracker <TRequest> .Track(subscription)); }
public IDisposable RegisterRequestHandler <TRequest>( Func <TRequest, CancellationToken, UniTask> handler, CancellationToken cancellationToken = default) where TRequest : IAsyncRequest { SubscriptionTracker <TRequest> .ThrowIfHasSubscribers(); var subscription = _asyncMessageBus.Subscribe <TRequest>( (msg, cancellationToken2) => Handle(handler, msg, cancellationToken, cancellationToken2) ); return(SubscriptionTracker <TRequest> .Track(subscription)); }