Ejemplo n.º 1
0
 public PortsMiddleware(IHandlerFactory factory, IPublisher <ICommand> commandPublisher)
     : base(factory)
 {
     BeginHandle.Use((execution) =>
     {
         IPublisher <ICommand> cronusCommandPublisher = new CronusPublisher <ICommand>(commandPublisher, execution.Context.CronusMessage);
         execution.Context.HandlerInstance.AssignPropertySafely <IPort>(x => x.CommandPublisher = cronusCommandPublisher);
     });
 }
 public ApplicationServiceMiddleware(IHandlerFactory factory, IAggregateRepository aggregateRepository, IPublisher <IEvent> eventPublisher) : base(factory)
 {
     BeginHandle.Use((execution) =>
     {
         IPublisher <IEvent> cronusEventPublisher = new CronusPublisher <IEvent>(eventPublisher, execution.Context.CronusMessage);
         var repo = new CronusAggregateRepository(aggregateRepository, cronusEventPublisher);
         execution.Context.HandlerInstance.AssignPropertySafely <IAggregateRootApplicationService>(x => x.Repository = repo);
     });
 }
Ejemplo n.º 3
0
        public SagasMiddleware(IHandlerFactory factory, IPublisher <ICommand> commandPublisher, IPublisher <IScheduledMessage> schedulePublisher)
            : base(factory)
        {
            BeginHandle.Use((execution) =>
            {
                IPublisher <ICommand> cronusCommandPublisher           = new CronusPublisher <ICommand>(commandPublisher, execution.Context.CronusMessage);
                IPublisher <IScheduledMessage> cronusSchedulePublisher = new CronusPublisher <IScheduledMessage>(schedulePublisher, execution.Context.CronusMessage);

                execution.Context.HandlerInstance.AssignPropertySafely <ISaga>(x => x.CommandPublisher        = cronusCommandPublisher);
                execution.Context.HandlerInstance.AssignPropertySafely <ISaga>(x => x.TimeoutRequestPublisher = cronusSchedulePublisher);
            });
        }