예제 #1
0
 public Mediator(ICommandReceivePipe <IReceiveContext <ICommand> > commandReceivePipe,
                 IEventReceivePipe <IReceiveContext <IEvent> > eventReceivePipe,
                 IRequestReceivePipe <IReceiveContext <IRequest> > requestPipe,
                 IPublishPipe <IPublishContext <IEvent> > publishPipe,
                 IGlobalReceivePipe <IReceiveContext <IMessage> > globalPipe, IDependancyScope scope = null)
 {
     _commandReceivePipe = commandReceivePipe;
     _eventReceivePipe   = eventReceivePipe;
     _requestPipe        = requestPipe;
     _publishPipe        = publishPipe;
     _globalPipe         = globalPipe;
     _scope = scope;
 }
예제 #2
0
 public JobConfigurator(Type typeOfMapper, Type typeOfCombiner, Type typeOfReducer, Type typeOfDataBatchProcessor, int numberOfMappersPerNode = 0, int numberOfChunks = 4, IDependancyScope dependancyScope = null)
 {
     if (numberOfChunks == 0)
     {
         numberOfChunks = 4;
     }
     TypeOfMapper             = typeOfMapper;
     TypeOfCombiner           = typeOfCombiner;
     TypeOfReducer            = typeOfReducer;
     TypeOfDataBatchProcessor = typeOfDataBatchProcessor;
     NumberOfMappersPerNode   = numberOfMappersPerNode;
     NumberOfChunks           = numberOfChunks;
     DependancyScope          = dependancyScope;
 }
예제 #3
0
 public JobConfigurator UseIoC(IDependancyScope scope)
 {
     DependancyScope = scope;
     return(this);
 }
 public EventReceivePipeConfigurator(IDependancyScope resolver = null)
 {
     _resolver       = resolver;
     _specifications = new List <IPipeSpecification <IReceiveContext <IEvent> > >();
 }
예제 #5
0
 public CommandReceivePipe(IPipeSpecification <TContext> specification, IPipe <TContext> next, IDependancyScope resolver = null)
 {
     _specification = specification;
     _resolver      = resolver;
     Next           = next;
 }
예제 #6
0
 public GlobalRececivePipeConfigurator(IDependancyScope resolver = null)
 {
     _resolver       = resolver;
     _specifications = new List <IPipeSpecification <IReceiveContext <IMessage> > >();
 }
예제 #7
0
 public RequestPipe(IPipeSpecification <TContext> specification, IPipe <TContext> next, IDependancyScope resolver)
 {
     Next           = next;
     _specification = specification;
     _resolver      = resolver;
 }
예제 #8
0
 public PublishPipe(IPipeSpecification <TContext> specification, IPipe <TContext> next, IDependancyScope resolver = null)
 {
     Next           = next;
     _specification = specification;
     _resolver      = resolver;
 }
예제 #9
0
        public IMediator Build(IDependancyScope scope)
        {
            IGlobalReceivePipe <IReceiveContext <IMessage> >  globalReceivePipe;
            ICommandReceivePipe <IReceiveContext <ICommand> > commandReceivePipe;
            IEventReceivePipe <IReceiveContext <IEvent> >     eventReceivePipe;
            IRequestReceivePipe <IReceiveContext <IRequest> > requestPipe;
            IPublishPipe <IPublishContext <IEvent> >          publishPipe;

            var receivePipeConfigurator = new CommandReceivePipeConfigurator(scope);

            if (_commandReceivePipeConfiguratorAction == null)
            {
                commandReceivePipe = receivePipeConfigurator.Build();
            }
            else
            {
                _commandReceivePipeConfiguratorAction(receivePipeConfigurator);
                commandReceivePipe = receivePipeConfigurator.Build();
            }

            var eventReceivePipeConfigurator = new EventReceivePipeConfigurator(scope);

            if (_eventReceivePipeConfiguratorAction == null)
            {
                eventReceivePipe = eventReceivePipeConfigurator.Build();
            }
            else
            {
                _eventReceivePipeConfiguratorAction(eventReceivePipeConfigurator);
                eventReceivePipe = eventReceivePipeConfigurator.Build();
            }

            var requestPipeConfigurator = new RequestPipeConfigurator(scope);

            if (_requestPipeConfiguratorAction == null)
            {
                requestPipe = requestPipeConfigurator.Build();
            }
            else
            {
                _requestPipeConfiguratorAction(requestPipeConfigurator);
                requestPipe = requestPipeConfigurator.Build();
            }

            var publishPipeConfigurator = new PublishPipeConfigurator(scope);

            if (_publishPipeConfiguratorAction == null)
            {
                publishPipe = publishPipeConfigurator.Build();
            }
            else
            {
                _publishPipeConfiguratorAction(publishPipeConfigurator);
                publishPipe = publishPipeConfigurator.Build();
            }

            var globalPipeConfigurator = new GlobalRececivePipeConfigurator(scope);

            if (_globalReceivePipeConfiguratorAction == null)
            {
                globalReceivePipe = globalPipeConfigurator.Build();
            }
            else
            {
                _globalReceivePipeConfiguratorAction(globalPipeConfigurator);
                globalReceivePipe = globalPipeConfigurator.Build();
            }

            return(new Mediator(commandReceivePipe, eventReceivePipe, requestPipe, publishPipe, globalReceivePipe, scope));
        }