internal static async Task DeliverImmediatelyOnConfiguredScheduler <TAggregate>( IScheduledCommand <TAggregate> command, Configuration configuration) where TAggregate : class, IEventSourced { var scheduler = configuration.CommandScheduler <TAggregate>(); await scheduler.Deliver(command); }
public static Configuration SubscribeCommandSchedulerToEventBusFor <TAggregate>(this Configuration configuration) where TAggregate : class, IEventSourced { var consequenter = Consequenter.Create <IScheduledCommand <TAggregate> >(e => { Task.Run(() => configuration.CommandScheduler <TAggregate>().Schedule(e)).Wait(); }); var subscription = configuration.EventBus.Subscribe(consequenter); configuration.RegisterForDisposal(subscription); return(configuration); }
internal static async Task DeliverImmediatelyOnConfiguredScheduler <TAggregate>( IScheduledCommand <TAggregate> command, Configuration configuration) where TAggregate : class => await configuration.CommandScheduler <TAggregate>().Deliver(command);