コード例 #1
0
 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();
 }
コード例 #2
0
 /// <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();
 }
コード例 #3
0
        /// <summary>
        /// Creates new instance.
        /// </summary>
        /// <param name="store">The publishing store for command persistent delivery.</param>
        /// <param name="schedulingProvider">The provider of a delay computation for delayed events.</param>
        public PersistentEventDispatcher(IEventPublishingStore store, ISchedulingProvider schedulingProvider)
        {
            Ensure.NotNull(store, "store");
            Ensure.NotNull(schedulingProvider, "schedulingProvider");
            this.store = store;
            this.schedulingProvider = schedulingProvider;

            EventExceptionHandlers      = new DefaultExceptionHandlerCollection();
            DispatcherExceptionHandlers = new DefaultExceptionHandlerCollection();

            this.descriptorProvider = new HandlerDescriptorProvider(
                typeof(IEventHandler <>),
                typeof(IEventHandlerContext <>),
                TypeHelper.MethodName <IEventHandler <object>, object, Task>(h => h.HandleAsync),
                EventExceptionHandlers,
                DispatcherExceptionHandlers
                );

            Handlers = new HandlerCollection(storage, descriptorProvider);
        }
コード例 #4
0
 /// <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())
 {
 }
コード例 #5
0
 /// <summary>
 /// Sets <paramref name="schedulingProvider"/> to be used for delaying commands on all newly created dispatchers.
 /// </summary>
 /// <param name="schedulingProvider">The provider of a delay computation for delayed commands (can be <c>null</c> for reseting to default).</param>
 /// <returns>Self (for fluency).</returns>
 public PersistentCommandDispatcherBuilder UseSchedulingProvider(ISchedulingProvider schedulingProvider)
 {
     this.schedulingProvider = schedulingProvider;
     return(this);
 }
コード例 #6
0
 /// <summary>
 /// Creates new instance.
 /// </summary>
 /// <param name="store">A publishing store for command persistent delivery.</param>
 /// <param name="schedulingProvider">A provider of a delay computation for delayed events.</param>
 public PersistentEventDispatcher(IEventPublishingStore store, ISchedulingProvider schedulingProvider)
     : this(store, schedulingProvider, new DefaultLogFactory())
 {
 }