Example #1
0
 public EventJsonSerializer(
     IJsonSerializer jsonSerializer,
     IEventDefinitionService eventDefinitionService)
 {
     _jsonSerializer         = jsonSerializer;
     _eventDefinitionService = eventDefinitionService;
 }
Example #2
0
 public EventPublisher(IEventDefinitionService eventDefinitionService, IPointLedgerRepository pointLedgerRepository, IFeedService feedService, IAwardCalculator awardCalculator, IProfileService profileService)
 {
     _eventDefinitionService = eventDefinitionService;
     _pointLedgerRepository  = pointLedgerRepository;
     _feedService            = feedService;
     _awardCalculator        = awardCalculator;
     _profileService         = profileService;
 }
Example #3
0
		public EventPublisher(IEventDefinitionService eventDefinitionService, IPointLedgerRepository pointLedgerRepository, IFeedService feedService, IAwardCalculator awardCalculator, IProfileService profileService)
		{
			_eventDefinitionService = eventDefinitionService;
			_pointLedgerRepository = pointLedgerRepository;
			_feedService = feedService;
			_awardCalculator = awardCalculator;
			_profileService = profileService;
		}
Example #4
0
        protected AggregateSaga()
        {
            Settings = new AggregateSagaSettings(Context.System.Settings.Config);
            var idValue = Context.Self.Path.Name;

            PersistenceId = idValue;
            Id            = (TIdentity)Activator.CreateInstance(typeof(TIdentity), idValue);

            if (Id == null)
            {
                throw new InvalidOperationException(
                          $"Identity for Saga '{Id.GetType().PrettyPrint()}' could not be activated.");
            }

            if ((this as TAggregateSaga) == null)
            {
                throw new InvalidOperationException(
                          $"AggregateSaga {Name} specifies Type={typeof(TAggregateSaga).PrettyPrint()} as generic argument, it should be its own type.");
            }

            if (State == null)
            {
                try
                {
                    State = (TSagaState)Activator.CreateInstance(typeof(TSagaState));
                }
                catch (Exception exception)
                {
                    Context.GetLogger().Error(exception, "AggregateSaga of Name={1}; was unable to activate SagaState of Type={0}.", Name, typeof(TSagaState).PrettyPrint());
                }
            }

            if (Settings.AutoReceive)
            {
                InitReceives();
                InitAsyncReceives();
            }

            InitTimeoutJobManagers();
            InitAsyncTimeoutJobManagers();

            if (Settings.UseDefaultEventRecover)
            {
                Recover <ICommittedEvent <TAggregateSaga, TIdentity, IAggregateEvent <TAggregateSaga, TIdentity> > >(Recover);
                Recover <RecoveryCompleted>(Recover);
            }

            if (Settings.UseDefaultSnapshotRecover)
            {
                Recover <SnapshotOffer>(Recover);
            }

            Command <SaveSnapshotSuccess>(SnapshotStatus);
            Command <SaveSnapshotFailure>(SnapshotStatus);

            _eventDefinitionService    = new EventDefinitionService(Context.GetLogger());
            _snapshotDefinitionService = new SnapshotDefinitionService(Context.GetLogger());
        }
Example #5
0
        public ReadmodelRebuildService(
            IReadModelPopulator readModelPopulator,
            IEventDefinitionService eventDefinitionService)
        {
            _readModelPopulator     = readModelPopulator;
            _eventDefinitionService = eventDefinitionService;

            RegisterAllEvents();
        }
Example #6
0
 public EventJsonSerializer(
     IJsonSerializer jsonSerializer,
     IEventDefinitionService eventDefinitionService,
     IDomainEventFactory domainEventFactory)
 {
     _jsonSerializer         = jsonSerializer;
     _eventDefinitionService = eventDefinitionService;
     _domainEventFactory     = domainEventFactory;
 }
Example #7
0
        protected AggregateSaga()
        {
            Logger   = Context.GetLogger();
            Settings = new AggregateSagaSettings(Context.System.Settings.Config);
            var idValue = Context.Self.Path.Name;

            PersistenceId = idValue;
            Id            = (TIdentity)Activator.CreateInstance(typeof(TIdentity), idValue);

            if (Id == null)
            {
                throw new InvalidOperationException(
                          $"Identity for Saga '{Id.GetType().PrettyPrint()}' could not be activated.");
            }

            if ((this as TAggregateSaga) == null)
            {
                throw new InvalidOperationException(
                          $"AggregateSaga '{GetType().PrettyPrint()}' specifies '{typeof(TAggregateSaga).PrettyPrint()}' as generic argument, it should be its own type");
            }

            if (State == null)
            {
                try
                {
                    State = (TSagaState)Activator.CreateInstance(typeof(TSagaState));
                }
                catch
                {
                    Logger.Warning($"Unable to activate State for {GetType()}");
                }
            }

            if (Settings.AutoReceive)
            {
                InitReceives();
                InitAsyncReceives();
            }

            Register(State);

            if (Settings.UseDefaultEventRecover)
            {
                Recover <ICommittedEvent <TAggregateSaga, TIdentity, IAggregateEvent <TAggregateSaga, TIdentity> > >(Recover);
                Recover <RecoveryCompleted>(Recover);
            }


            if (Settings.UseDefaultSnapshotRecover)
            {
                Recover <SnapshotOffer>(Recover);
            }


            _eventDefinitionService    = new EventDefinitionService(Logger);
            _snapshotDefinitionService = new SnapshotDefinitionService(Logger);
        }
Example #8
0
		public AwardCalculator(IAwardCalculationQueueRepository awardCalcRepository, IEventDefinitionService eventDefinitionService, IUserRepository userRepository, IErrorLog errorLog, IAwardDefinitionService awardDefinitionService, IUserAwardService userAwardService, IPointLedgerRepository pointLedgerRepository)
		{
			_awardCalcRepository = awardCalcRepository;
			_eventDefinitionService = eventDefinitionService;
			_userRepository = userRepository;
			_errorLog = errorLog;
			_awardDefinitionService = awardDefinitionService;
			_userAwardService = userAwardService;
			_pointLedgerRepository = pointLedgerRepository;
		}
 public AwardCalculator(IAwardCalculationQueueRepository awardCalcRepository, IEventDefinitionService eventDefinitionService, IUserRepository userRepository, IErrorLog errorLog, IAwardDefinitionService awardDefinitionService, IUserAwardService userAwardService, IPointLedgerRepository pointLedgerRepository)
 {
     _awardCalcRepository    = awardCalcRepository;
     _eventDefinitionService = eventDefinitionService;
     _userRepository         = userRepository;
     _errorLog = errorLog;
     _awardDefinitionService = awardDefinitionService;
     _userAwardService       = userAwardService;
     _pointLedgerRepository  = pointLedgerRepository;
 }
Example #10
0
 public CustomEventJsonSerializer(ILog log,
                                  IJsonSerializer jsonSerializer,
                                  IEventDefinitionService eventDefinitionService,
                                  IDomainEventFactory domainEventFactory)
 {
     _jsonSerializer         = jsonSerializer;
     _eventDefinitionService = eventDefinitionService;
     _domainEventFactory     = domainEventFactory;
     _log = log;
 }
 public DefinitionServicesInitilizer(
     ILoadedVersionedTypes loadedVersionedTypes,
     IEventDefinitionService eventDefinitionService,
     ICommandDefinitionService commandDefinitionService,
     IJobDefinitionService jobDefinitionService)
 {
     _loadedVersionedTypes = loadedVersionedTypes;
     _eventDefinitionService = eventDefinitionService;
     _commandDefinitionService = commandDefinitionService;
     _jobDefinitionService = jobDefinitionService;
 }
 public DefinitionServicesInitilizer(
     ILoadedVersionedTypes loadedVersionedTypes,
     IEventDefinitionService eventDefinitionService,
     ICommandDefinitionService commandDefinitionService,
     IJobDefinitionService jobDefinitionService)
 {
     _loadedVersionedTypes     = loadedVersionedTypes;
     _eventDefinitionService   = eventDefinitionService;
     _commandDefinitionService = commandDefinitionService;
     _jobDefinitionService     = jobDefinitionService;
 }
Example #13
0
        protected AggregateRoot(TIdentity id)
        {
            Settings = new AggregateRootSettings(Context.System.Settings.Config);

            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            if ((this as TAggregate) == null)
            {
                throw new InvalidOperationException(
                          $"Aggregate {Name} specifies Type={typeof(TAggregate).PrettyPrint()} as generic argument, it should be its own type.");
            }

            if (State == null)
            {
                try
                {
                    State = (TAggregateState)Activator.CreateInstance(typeof(TAggregateState));
                }
                catch (Exception exception)
                {
                    Context.GetLogger().Error(exception, "Unable to activate AggregateState of Type={0} for AggregateRoot of Name={1}.", typeof(TAggregateState).PrettyPrint(), Name);
                }
            }

            PinnedCommand              = null;
            _eventDefinitionService    = new EventDefinitionService(Context.GetLogger());
            _snapshotDefinitionService = new SnapshotDefinitionService(Context.GetLogger());
            Id            = id;
            PersistenceId = id.Value;
            SetSourceIdHistory(100);

            if (Settings.UseDefaultSnapshotRecover)
            {
                Recover <SnapshotOffer>(Recover);
            }

            Command <SaveSnapshotSuccess>(SnapshotStatus);
            Command <SaveSnapshotFailure>(SnapshotStatus);

            if (Settings.UseDefaultEventRecover)
            {
                Recover <ICommittedEvent <TAggregate, TIdentity, IAggregateEvent <TAggregate, TIdentity> > >(Recover);
                Recover <RecoveryCompleted>(Recover);
            }

            InitReceives();
            SetReceiveTimeout(Settings.SetReceiveTimeout);
            Command <ReceiveTimeout>(Timeout);
        }
Example #14
0
        protected AggregateRoot(TIdentity id)
        {
            Logger   = Context.GetLogger();
            Settings = new AggregateRootSettings(Context.System.Settings.Config);
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if ((this as TAggregate) == null)
            {
                throw new InvalidOperationException(
                          $"Aggregate '{GetType().PrettyPrint()}' specifies '{typeof(TAggregate).PrettyPrint()}' as generic argument, it should be its own type");
            }

            if (State == null)
            {
                try
                {
                    State = (TAggregateState)Activator.CreateInstance(typeof(TAggregateState));
                }
                catch
                {
                    Logger.Error($"Unable to activate State for {GetType()}");
                }
            }

            _eventDefinitionService    = new EventDefinitionService(Logger);
            _snapshotDefinitionService = new SnapshotDefinitionService(Logger);
            Id            = id;
            PersistenceId = id.Value;
            Register(State);

            if (Settings.UseDefaultSnapshotRecover)
            {
                Recover <SnapshotOffer>(Recover);
            }


            Command <SaveSnapshotSuccess>(SnapshotStatus);
            Command <SaveSnapshotFailure>(SnapshotStatus);

            if (Settings.UseDefaultEventRecover)
            {
                Recover <ICommittedEvent <TAggregate, TIdentity, IAggregateEvent <TAggregate, TIdentity> > >(Recover);
                Recover <RecoveryCompleted>(Recover);
            }
        }
Example #15
0
		protected internal AdminController(IUserService userService, IProfileService profileService, ISettingsManager settingsManager, ICategoryService categoryService, IForumService forumService, ISearchService searchService, ISecurityLogService securityLogService, IErrorLog errorLog, IBanService banService, IModerationLogService modLogService, IIPHistoryService ipHistoryService, IImageService imageService, IMailingListService mailingListService, IEventDefinitionService eventDefinitionService, IAwardDefinitionService awardDefinitionService, IEventPublisher eventPublisher)
		{
			_userService = userService;
			_profileService = profileService;
			_settingsManager = settingsManager;
			_categoryService = categoryService;
			_forumService = forumService;
			_searchService = searchService;
			_securityLogService = securityLogService;
			_errorLogService = errorLog;
			_banService = banService;
			_moderationLogService = modLogService;
			_ipHistoryService = ipHistoryService;
			_imageService = imageService;
			_mailingListService = mailingListService;
			_eventDefinitionService = eventDefinitionService;
			_awardDefinitionService = awardDefinitionService;
			_eventPublisher = eventPublisher;
		}
Example #16
0
 protected internal AdminController(IUserService userService, IProfileService profileService, ISettingsManager settingsManager, ICategoryService categoryService, IForumService forumService, ISearchService searchService, ISecurityLogService securityLogService, IErrorLog errorLog, IBanService banService, IModerationLogService modLogService, IIPHistoryService ipHistoryService, IImageService imageService, IMailingListService mailingListService, IEventDefinitionService eventDefinitionService, IAwardDefinitionService awardDefinitionService, IEventPublisher eventPublisher)
 {
     _userService            = userService;
     _profileService         = profileService;
     _settingsManager        = settingsManager;
     _categoryService        = categoryService;
     _forumService           = forumService;
     _searchService          = searchService;
     _securityLogService     = securityLogService;
     _errorLogService        = errorLog;
     _banService             = banService;
     _moderationLogService   = modLogService;
     _ipHistoryService       = ipHistoryService;
     _imageService           = imageService;
     _mailingListService     = mailingListService;
     _eventDefinitionService = eventDefinitionService;
     _awardDefinitionService = awardDefinitionService;
     _eventPublisher         = eventPublisher;
 }
 public AdminApiController(ISettingsManager settingsManager, ICategoryService categoryService, IForumService forumService, IUserService userService, ISearchService searchService, IProfileService profileService, IUserRetrievalShim userRetrievalShim, IImageService imageService, IBanService banService, IMailingListService mailingListService, IEventDefinitionService eventDefinitionService, IAwardDefinitionService awardDefinitionService, IEventPublisher eventPublisher, IIPHistoryService ipHistoryService, ISecurityLogService securityLogService, IModerationLogService moderationLogService, IErrorLog errorLog, IServiceHeartbeatService serviceHeartbeatService)
 {
     _settingsManager        = settingsManager;
     _categoryService        = categoryService;
     _forumService           = forumService;
     _userService            = userService;
     _searchService          = searchService;
     _profileService         = profileService;
     _userRetrievalShim      = userRetrievalShim;
     _imageService           = imageService;
     _banService             = banService;
     _mailingListService     = mailingListService;
     _eventDefinitionService = eventDefinitionService;
     _awardDefinitionService = awardDefinitionService;
     _eventPublisher         = eventPublisher;
     _ipHistoryService       = ipHistoryService;
     _securityLogService     = securityLogService;
     _moderationLogService   = moderationLogService;
     _errorLog = errorLog;
     _serviceHeartbeatService = serviceHeartbeatService;
 }
 public TestableAdminController(IUserService userService, IProfileService profileService, ISettingsManager settingsManager, ICategoryService categoryService, IForumService forumService, ISearchService searchService, ISecurityLogService securityLogService, IErrorLog errorLog, IBanService banService, IModerationLogService modLogService, IIPHistoryService ipHistoryService, IImageService imageService, IMailingListService mailingListService, IEventDefinitionService eventDefinitonService, IAwardDefinitionService awardDefinitionService, IEventPublisher eventPublisher) : base(userService, profileService, settingsManager, categoryService, forumService, searchService, securityLogService, errorLog, banService, modLogService, ipHistoryService, imageService, mailingListService, eventDefinitonService, awardDefinitionService, eventPublisher)
 {
 }
			public TestableAdminController(IUserService userService, IProfileService profileService, ISettingsManager settingsManager, ICategoryService categoryService, IForumService forumService, ISearchService searchService, ISecurityLogService securityLogService, IErrorLog errorLog, IBanService banService, IModerationLogService modLogService, IIPHistoryService ipHistoryService, IImageService imageService, IMailingListService mailingListService, IEventDefinitionService eventDefinitonService, IAwardDefinitionService awardDefinitionService, IEventPublisher eventPublisher) : base(userService, profileService, settingsManager, categoryService, forumService, searchService, securityLogService, errorLog, banService, modLogService, ipHistoryService, imageService, mailingListService, eventDefinitonService, awardDefinitionService, eventPublisher) { }
Example #20
0
 public EventInitializer(IEventDefinitionService eventDefinitionService, IEnumerable <EventContainingAssembly> eventAssemblies)
 {
     _eventDefinitionService = eventDefinitionService ?? throw new ArgumentNullException(nameof(eventDefinitionService));
     _eventAssemblies        = eventAssemblies ?? throw new ArgumentNullException(nameof(eventAssemblies));
 }