internal PersistentCommandDispatcher(TreeQueue queue, TreeQueueThreadPool threadPool, ICommandDistributor distributor, ICommandPublishingStore store, ISerializer formatter, ISchedulingProvider schedulingProvider) { this.queue = queue; this.threadPool = threadPool; this.distributor = distributor; this.store = store; this.formatter = formatter; this.schedulingProvider = schedulingProvider; Initialize(); }
/// <summary> /// Creates new instance. /// </summary> /// <param name="distributor">The command-to-the-queue distributor.</param> /// <param name="store">The publishing store for command persistent delivery.</param> /// <param name="formatter">The formatter for serializing commands.</param> /// <param name="schedulingProvider">The provider of a delay computation for delayed commands.</param> public PersistentCommandDispatcher(ICommandDistributor distributor, ICommandPublishingStore store, ISerializer formatter, ISchedulingProvider schedulingProvider) { Ensure.NotNull(distributor, "distributor"); Ensure.NotNull(store, "store"); Ensure.NotNull(formatter, "formatter"); Ensure.NotNull(schedulingProvider, "schedulingProvider"); this.distributor = distributor; this.store = store; this.formatter = formatter; this.threadPool = new TreeQueueThreadPool(queue); this.schedulingProvider = schedulingProvider; Initialize(); }
/// <summary> /// Creates new instance. /// </summary> /// <param name="distributor">The command-to-the-queue distributor.</param> /// <param name="store">The publishing store for command persistent delivery.</param> /// <param name="formatter">The formatter for serializing commands.</param> /// <param name="schedulingProvider">The provider of a delay computation for delayed commands.</param> public PersistentCommandDispatcher(ICommandDistributor distributor, ICommandPublishingStore store, ISerializer formatter, ISchedulingProvider schedulingProvider) : this(distributor, store, formatter, schedulingProvider, new DefaultLogFactory()) { }
/// <summary> /// Creates new instance with <see cref="DateTime.Now"/> as current date time provider. /// </summary> /// <param name="distributor">The command-to-the-queue distributor.</param> /// <param name="store">The publishing store for command persistent delivery.</param> /// <param name="formatter">The formatter for serializing commands.</param> public PersistentCommandDispatcher(ICommandDistributor distributor, ICommandPublishingStore store, ISerializer formatter) : this(distributor, store, formatter, new TimerSchedulingProvider(new TimerSchedulingProvider.DateTimeNowProvider())) { }
/// <summary> /// Sets <paramref name="distributor"/> to be used for distributing commands on all newly created dispatchers. /// </summary> /// <param name="distributor">The command-to-the-queue distributor.</param> /// <returns>Self (for fluency).</returns> public PersistentCommandDispatcherBuilder UseCommandDistributor(ICommandDistributor distributor) { Ensure.NotNull(distributor, "distributor"); this.distributor = distributor; return(this); }