Example #1
0
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            IEventsBus eventsBus)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new LoggingModule(logger.ForContext("Module", "Meetings")));

            var loggerFactory = new SerilogLoggerFactory(logger);

            containerBuilder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));

            containerBuilder.RegisterModule(new ProcessingModule());
            containerBuilder.RegisterModule(new EventsBusModule(eventsBus));
            containerBuilder.RegisterModule(new MediatorModule());
            containerBuilder.RegisterModule(new AuthenticationModule());
            containerBuilder.RegisterModule(new OutboxModule());
            containerBuilder.RegisterModule(new EmailModule(emailsConfiguration));
            containerBuilder.RegisterModule(new QuartzModule());

            containerBuilder.RegisterInstance(executionContextAccessor);

            _container = containerBuilder.Build();

            MeetingsCompositionRoot.SetContainer(_container);
        }
Example #2
0
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            string textEncryptionKey,
            IEventsBus eventsBus,
            IEmailSender emailSender,
            bool runQuartz = true)
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule(new LoggingModule(logger.ForContext("Module", "Phrases")));

            var loggerFactory = new Serilog.Extensions.Logging.SerilogLoggerFactory(logger);

            builder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));
            builder.RegisterModule(new DomainModule());
            builder.RegisterModule(new ProcessingModule());
            builder.RegisterModule(new EventsBusModule(eventsBus));
            builder.RegisterModule(new MediatorModule());
            builder.RegisterModule(new OutboxModule());
            builder.RegisterModule(new EmailModule(emailsConfiguration, emailSender));
            builder.RegisterModule(new QuartzModule());

            builder.RegisterInstance(executionContextAccessor);

            _container = builder.Build();

            PhrasesCompositionRoot.SetContainer(_container);
        }
Example #3
0
 public TalkViewModel(IEventsBus eventsBus, Talk talk)
 {
     _eventsBus = eventsBus;
     Talk       = talk;
     CreateSpeakersViewModel();
     ViewDetailCommand = new RelayCommand(OnViewDetailCommand);
 }
 private static void SubscribeToIntegrationEvent <T>(IEventsBus eventBus, ILogger logger)
     where T : IntegrationEvent
 {
     logger.Information("Subscribe to {@IntegrationEvent}", typeof(T).FullName);
     eventBus.Subscribe(
         new IntegrationEventGenericHandler <T>());
 }
Example #5
0
        public static void Initialize(string connectionString,
                                      IExecutionContextAccessor executionContextAccessor,
                                      ILogger logger,
                                      EmailsConfiguration emailsConfiguration,
                                      string textEncryptionKey,
                                      IEmailSender emailSender,
                                      IEventsBus eventsBus,
                                      bool runQuartz = true)
        {
            var moduleLogger = logger.ForContext("Module", "Matches");

            ConfigureCompositionRoot(connectionString,
                                     executionContextAccessor,
                                     logger,
                                     emailsConfiguration,
                                     textEncryptionKey,
                                     eventsBus,
                                     emailSender,
                                     runQuartz);

            if (runQuartz)
            {
                QuartzStartup.Initialize(moduleLogger);
            }

            EventsBusStartup.Initialize(moduleLogger);
        }
Example #6
0
        private static void ConfigureContainer(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            IEventsBus eventsBus)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new LoggingModule(logger));

            var loggerFactory = new SerilogLoggerFactory(logger);

            containerBuilder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));

            containerBuilder.RegisterModule(new ProcessingModule());
            containerBuilder.RegisterModule(new EventsBusModule(eventsBus));
            containerBuilder.RegisterModule(new MediatorModule());
            containerBuilder.RegisterModule(new AuthenticationModule());

            var domainNotificationsMap = new BiDictionary <string, Type>();

            domainNotificationsMap.Add("MeetingGroupProposalAcceptedNotification", typeof(MeetingGroupProposalAcceptedNotification));
            containerBuilder.RegisterModule(new OutboxModule(domainNotificationsMap));

            containerBuilder.RegisterModule(new QuartzModule());

            containerBuilder.RegisterInstance(executionContextAccessor);

            _container = containerBuilder.Build();

            AdministrationCompositionRoot.SetContainer(_container);
        }
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            IEventsBus eventsBus,
            bool runQuartz = true)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new LoggingModule(logger));

            var loggerFactory = new SerilogLoggerFactory(logger);

            containerBuilder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));

            containerBuilder.RegisterModule(new ProcessingModule());
            containerBuilder.RegisterModule(new EventsBusModule(eventsBus));
            containerBuilder.RegisterModule(new MediatorModule());
            containerBuilder.RegisterModule(new AuthenticationModule());
            containerBuilder.RegisterModule(new OutboxModule());

            if (runQuartz)
            {
                containerBuilder.RegisterModule(new QuartzModule());
            }

            containerBuilder.RegisterInstance(executionContextAccessor);

            _container = containerBuilder.Build();

            PaymentsCompositionRoot.SetContainer(_container);

            RunEventsProjectors();
        }
Example #8
0
 public DetailsViewModel(IEventsBus eventsBus, Talk talk)
 {
     _eventsBus     = eventsBus;
     _talk          = talk;
     DuringThisTime = new RelayCommand(OnDuringThisTime);
     CreateSpeakersViewModel(talk);
 }
Example #9
0
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            IEventsBus eventsBus,
            IEmailSender emailSender)
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule(new LoggingModule(logger.ForContext("Module", "Matches")));

            var loggerFactory = new SerilogLoggerFactory(logger);


            builder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));
            builder.RegisterModule(new DomainModule());
            builder.RegisterModule(new ProcessingModule());
            builder.RegisterModule(new EventsBusModule(eventsBus));
            builder.RegisterModule(new MediatorModule());
            builder.RegisterModule(new OutboxModule());
            builder.RegisterModule(new EmailModule(emailsConfiguration, emailSender));
            builder.RegisterModule(new QuartzModule());
            builder.RegisterModule(new IntegrationModule());
            //TODO: Add Integration Events Events

            builder.RegisterInstance(executionContextAccessor);

            _container = builder.Build();

            MatchesCompositionRoot.SetContainer(_container);
        }
Example #10
0
 public SaveRuleCommandHandler(IContextFactory contextFactory,
                               IMapper mapper,
                               IEventsBus eventsBus)
 {
     this.contextFactory = contextFactory;
     this.mapper         = mapper;
     this.eventsBus      = eventsBus;
 }
Example #11
0
        public RoomViewModel(IEventsBus eventsBus, Room room)
        {
            Room = room;

            Talks = new ObservableCollection <TalkViewModel>();
            foreach (var talk in Room.Talks)
            {
                Talks.Add(new TalkViewModel(eventsBus, talk));
            }
        }
Example #12
0
 public CommandsBus(Func <Type, IHandleCommand> handlersFactory,
                    Func <Type, IHandleCommandAsync> asyncHandlersFactory,
                    Func <Type, IValidateCommand> validatorsFactory,
                    IEventsBus eventsBus)
 {
     _handlersFactory      = handlersFactory;
     _asyncHandlersFactory = asyncHandlersFactory;
     _validatorsFactory    = validatorsFactory;
     _eventsBus            = eventsBus;
 }
Example #13
0
 public ImportCommandHandler(ILogger <ImportCommandHandler> logger,
                             IEnumerable <IImporter> importers,
                             BankTransactionAccess bankTransactionAccess,
                             IEventsBus eventsBus)
 {
     this.logger                = logger;
     this.importers             = importers;
     this.bankTransactionAccess = bankTransactionAccess;
     this.eventsBus             = eventsBus;
 }
Example #14
0
 public QueryBus(Func <Type, Type, IHandleQuery> handlersFactory,
                 Func <Type, Type, IHandleQueryAsync> asyncHandlersFactory,
                 Func <Type, IValidateQuery> validatorsFactory,
                 IEventsBus eventsBus)
 {
     _handlersFactory      = handlersFactory;
     _asyncHandlersFactory = asyncHandlersFactory;
     _validatorsFactory    = validatorsFactory;
     _eventsBus            = eventsBus;
 }
Example #15
0
 public TalksViewModel(IEventsBus eventsBus)
 {
     _eventsBus            = eventsBus;
     Rooms                 = new ObservableCollection <RoomViewModel>();
     _repository           = new MixItRepository(DispatcherHelper.UIDispatcher);
     TalkClickCommand      = new RelayCommand(OnTalkClick);
     LigthtalkClickCommand = new RelayCommand(OnLigthtalkClick);
     FirstDayClickCommand  = new RelayCommand(OnFirstDayClick);
     SecondDayClickCommand = new RelayCommand(OnSecondDayClick);
     ReloadData            = new RelayCommand(InitializeAsync);
 }
Example #16
0
        public MainViewModel()
        {
            _eventsBus = new EventsBus();
            _eventsBus.On <DetailsPageRequested>(DisplayDetailsPage);
            _eventsBus.On <DuringThisTimeRequired>(DisplayDuringThisTimePage);

            var talksViewModel = new TalksViewModel(_eventsBus);

            talksViewModel.InitializeAsync();
            MainPage = talksViewModel;

            DisplayTalks();
        }
        public static void Initialize(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            IEventsBus eventsBus)
        {
            var moduleLogger = logger.ForContext("Module", "Administration");

            ConfigureContainer(connectionString, executionContextAccessor, moduleLogger, eventsBus);

            QuartzStartup.Initialize(moduleLogger);

            EventsBusStartup.Initialize(moduleLogger);
        }
Example #18
0
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            IEventsBus eventsBus,
            bool runQuartz = true)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new LoggingModule(logger));

            var loggerFactory = new SerilogLoggerFactory(logger);

            containerBuilder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));

            containerBuilder.RegisterModule(new ProcessingModule());
            containerBuilder.RegisterModule(new EmailModule(emailsConfiguration));
            containerBuilder.RegisterModule(new EventsBusModule(eventsBus));
            containerBuilder.RegisterModule(new MediatorModule());
            containerBuilder.RegisterModule(new AuthenticationModule());


            BiDictionary <string, Type> domainNotificationsMap = new BiDictionary <string, Type>();

            domainNotificationsMap.Add("MeetingFeePaidNotification", typeof(MeetingFeePaidNotification));
            domainNotificationsMap.Add("MeetingFeePaymentPaidNotification", typeof(MeetingFeePaymentPaidNotification));
            domainNotificationsMap.Add("SubscriptionCreatedNotification", typeof(SubscriptionCreatedNotification));
            domainNotificationsMap.Add("SubscriptionPaymentPaidNotification", typeof(SubscriptionPaymentPaidNotification));
            domainNotificationsMap.Add("SubscriptionRenewalPaymentPaidNotification", typeof(SubscriptionRenewalPaymentPaidNotification));
            domainNotificationsMap.Add("SubscriptionRenewedNotification", typeof(SubscriptionRenewedNotification));

            containerBuilder.RegisterModule(new OutboxModule(domainNotificationsMap));

            if (runQuartz)
            {
                containerBuilder.RegisterModule(new QuartzModule());
            }

            containerBuilder.RegisterInstance(executionContextAccessor);

            _container = containerBuilder.Build();

            PaymentsCompositionRoot.SetContainer(_container);

            RunEventsProjectors();
        }
        public static void Initialize(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            IEventsBus eventsBus,
            bool runQuartz = true)
        {
            var moduleLogger = logger.ForContext("Module", "Payments");

            ConfigureCompositionRoot(connectionString, executionContextAccessor, moduleLogger, eventsBus, runQuartz);

            if (runQuartz)
            {
                QuartzStartup.Initialize(moduleLogger);
            }

            EventsBusStartup.Initialize(moduleLogger);
        }
        public static void Initialize(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            IEventsBus eventsBus)
        {
            var moduleLogger = logger.ForContext("Module", "Meetings");

            ConfigureCompositionRoot(
                connectionString,
                executionContextAccessor,
                moduleLogger,
                emailsConfiguration,
                eventsBus);

            QuartzStartup.Initialize(moduleLogger);

            EventsBusStartup.Initialize(moduleLogger);
        }
        public async Task BeforeEachTest()
        {
            const string connectionStringEnvironmentVariable =
                "ASPNETCORE_MyMeetings_IntegrationTests_ConnectionString";

            ConnectionString = EnvironmentVariablesProvider.GetVariable(connectionStringEnvironmentVariable);
            if (ConnectionString == null)
            {
                throw new ApplicationException(
                          $"Define connection string to integration tests database using environment variable: {connectionStringEnvironmentVariable}");
            }

            using (var sqlConnection = new SqlConnection(ConnectionString))
            {
                await ClearDatabase(sqlConnection);
            }

            Logger           = Substitute.For <ILogger>();
            EmailSender      = Substitute.For <IEmailSender>();
            ExecutionContext = new ExecutionContextMock(Guid.NewGuid());

            EventsBus = new InMemoryEventBusClient(Logger);


            AdministrationModule = new AdministrationModule();
            MeetingsModule       = new MeetingsModule();
            MeetingsStartup      = new MeetingsStartup();

            AdministrationStartup.Initialize(
                ConnectionString,
                ExecutionContext,
                Logger,
                EventsBus);

            MeetingsStartup.Initialize(
                ConnectionString,
                ExecutionContext,
                Logger,
                new EmailsConfiguration("*****@*****.**"),
                EventsBus);
        }
Example #22
0
        private static void ConfigureCompositionRoot(
            string connectionString,
            IExecutionContextAccessor executionContextAccessor,
            ILogger logger,
            EmailsConfiguration emailsConfiguration,
            IEventsBus eventsBus)
        {
            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterModule(new LoggingModule(logger.ForContext("Module", "Meetings")));

            var loggerFactory = new SerilogLoggerFactory(logger);

            containerBuilder.RegisterModule(new DataAccessModule(connectionString, loggerFactory));
            containerBuilder.RegisterModule(new ProcessingModule());
            containerBuilder.RegisterModule(new EventsBusModule(eventsBus));
            containerBuilder.RegisterModule(new MediatorModule());
            containerBuilder.RegisterModule(new AuthenticationModule());

            var domainNotificationsMap = new BiDictionary <string, Type>();

            domainNotificationsMap.Add("MeetingGroupProposalAcceptedNotification", typeof(MeetingGroupProposalAcceptedNotification));
            domainNotificationsMap.Add("MeetingGroupProposedNotification", typeof(MeetingGroupProposedNotification));
            domainNotificationsMap.Add("MeetingGroupCreatedNotification", typeof(MeetingGroupCreatedNotification));
            domainNotificationsMap.Add("MeetingAttendeeAddedNotification", typeof(MeetingAttendeeAddedNotification));
            domainNotificationsMap.Add("MemberCreatedNotification", typeof(MemberCreatedNotification));
            domainNotificationsMap.Add("MemberSubscriptionExpirationDateChangedNotification", typeof(MemberSubscriptionExpirationDateChangedNotification));
            domainNotificationsMap.Add("MeetingCommentLikedNotification", typeof(MeetingCommentLikedNotification));
            domainNotificationsMap.Add("MeetingCommentUnlikedNotification", typeof(MeetingCommentUnlikedNotification));
            containerBuilder.RegisterModule(new OutboxModule(domainNotificationsMap));

            containerBuilder.RegisterModule(new EmailModule(emailsConfiguration));
            containerBuilder.RegisterModule(new QuartzModule());

            containerBuilder.RegisterInstance(executionContextAccessor);

            _container = containerBuilder.Build();

            MeetingsCompositionRoot.SetContainer(_container);
        }
Example #23
0
 public EventsBusModule(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }
 public MeetingGroupProposalAcceptedNotificationHandler(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }
 public SubscriptionCreatedNotificationHandler(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }
 public SaveAddressCommandHandler(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }
Example #27
0
 public PhraseCreatedPublishEventHandler(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }
Example #28
0
 public SignalRCommandsBus(ICommandsBus commandsBus, IEventsBus eventsBus)
 {
     this.commandsBus = commandsBus;
     this.eventsBus   = eventsBus;
 }
Example #29
0
 public MeetingFeePaidNotificationHandler(IEventsBus eventsBus, IAggregateStore aggregateStore)
 {
     _eventsBus      = eventsBus;
     _aggregateStore = aggregateStore;
 }
 public PaymentRegisteredNotificationHandler(IEventsBus eventsBus)
 {
     _eventsBus = eventsBus;
 }