public ShellExecuteCommandFactory(ICommandStore store) { _store = store; AddDirectoryCommands(@"C:\dev\shortcuts"); //AddDirectoryCommands(Environment.GetFolderPath(Environment.SpecialFolder.Desktop)); //AddDirectoryCommands(GetStartMenuFolder()); }
/// <summary> /// Creates new instance. /// </summary> /// <param name="eventStore">The underlaying event store.</param> /// <param name="commandStore">The underlaying command store.</param> /// <param name="eventFormatter">The formatter for serializing event payloads.</param> /// <param name="commandFormatter">The formatter for serializing commands.</param> /// <param name="factory">The process root factory.</param> /// <param name="eventDispatcher">The dispatcher for newly created events in the processes.</param> /// <param name="commandDispatcher">The dispatcher for newly created commands in the processes.</param> /// <param name="snapshotProvider">The snapshot provider.</param> /// <param name="snapshotStore">The store for snapshots.</param> public ProcessRootRepository(IEventStore eventStore, ICommandStore commandStore, IFormatter eventFormatter, ISerializer commandFormatter, IAggregateRootFactory <T> factory, IEventDispatcher eventDispatcher, ICommandDispatcher commandDispatcher, ISnapshotProvider snapshotProvider, ISnapshotStore snapshotStore) : base(eventStore, eventFormatter, factory, eventDispatcher, snapshotProvider, snapshotStore) { Ensure.NotNull(commandStore, "commandStore"); Ensure.NotNull(commandDispatcher, "commandDispatcher"); Ensure.NotNull(commandFormatter, "commandFormatter"); this.commandStore = commandStore; this.commandFormatter = commandFormatter; this.commandDispatcher = commandDispatcher; }
/// <summary> /// First time initialization and reconfig in case of restore /// </summary> /// <param name="model"></param> private void Configure(Model model) { _commandStore = _config.CreateCommandStore(); _snapshotStore = _config.CreateSnapshotStore(); _journalAppender = JournalAppender.Create(model.Revision + 1, _commandStore); _kernel = _config.CreateKernel(model); _kernel.SetSynchronizer(_synchronizer); //Capture events emitted during Command.Execute model.Events.Subscribe(e => _capturedEvents.Add(e)); }
public CommandSender(IResolver resolver, IEventPublisher eventPublisher, IEventFactory eventFactory, IEventStore eventStore, ICommandStore commandStore) { _resolver = resolver; _eventPublisher = eventPublisher; _eventFactory = eventFactory; _eventStore = eventStore; _commandStore = commandStore; }
private void AssertJournalEntriesAreSequential(ICommandStore storage) { ulong expected = 1; Console.WriteLine("JournalEntry Ids:"); foreach (var journalEntry in storage.CommandEntries()) { Console.WriteLine(journalEntry.Id); Assert.AreEqual(expected, journalEntry.Id); expected++; } }
public CommandSenderAsync(IHandlerResolver handlerResolver, IEventPublisherAsync eventPublisherAsync, IEventFactory eventFactory, IEventStore eventStore, ICommandStore commandStore) { _handlerResolver = handlerResolver; _eventPublisherAsync = eventPublisherAsync; _eventFactory = eventFactory; _eventStore = eventStore; _commandStore = commandStore; }
public PriorityProcessor( IRoomService roomService, ICommandStore commandService, IHttpService httpService, int roomId) { _roomService = roomService; _commandStore = commandService; _httpService = httpService; _roomId = roomId; _nativeCommands = LoadNativeCommands().ToDictionary(kvp => kvp.commandName, kvp => kvp.implementer); }
public CommandSender(IHandlerResolver handlerResolver, IEventPublisher eventPublisher, IEventFactory eventFactory, IEventStore eventStore, ICommandStore commandStore) { _eventPublisher = eventPublisher; _eventFactory = eventFactory; _eventStore = eventStore; _commandStore = commandStore; _handlerResolver = handlerResolver; }
public CommandExecutor( IRuntime runtime, ILifetimeScope lifetimeScope, ICommandStore commandStore, ICommandPermissionBuilder commandPermissionBuilder, IEventBus eventBus) { m_Runtime = runtime; m_LifetimeScope = lifetimeScope; m_CommandStore = commandStore; m_CommandPermissionBuilder = commandPermissionBuilder; m_EventBus = eventBus; }
public LineReaderService( ICommandContextFactory commandContextFactory, ICommandExecutor commandExecutor, ICommandParser commandParser, ICommandStore commandStore, ILogger <LineReaderService> logger) { _commandContextFactory = commandContextFactory; _commandExecutor = commandExecutor; _commandParser = commandParser; _commandStore = commandStore; _logger = logger; }
public CommandSenderAsync( IResolver resolver, IEventPublisherAsync eventPublisherAsync, IEventFactory eventFactory, IEventStore eventStore, ICommandStore commandStore) { this.resolver = resolver; this.eventPublisherAsync = eventPublisherAsync; this.eventFactory = eventFactory; this.eventStore = eventStore; this.commandStore = commandStore; }
public CommandExecutionService(IPositionRequestService positionRequestService, IOrderRequestService orderRequestService, IPositionCache positionCache, IOrderCache orderCache, ICommandStore commandStore, ILogger <CommandExecutionService> logger) { _positionRequestService = positionRequestService; _orderRequestService = orderRequestService; _positionCache = positionCache; _orderCache = orderCache; _commandStore = commandStore; _logger = logger; }
public CommandHelp( IPermissionChecker permissionChecker, ICommandStore commandStore, IServiceProvider serviceProvider, ICommandPermissionBuilder commandPermissionBuilder, ICommandContextBuilder commandContextBuilder, IOpenModStringLocalizer stringLocalizer) : base(serviceProvider) { m_PermissionChecker = permissionChecker; m_CommandStore = commandStore; m_CommandPermissionBuilder = commandPermissionBuilder; m_CommandContextBuilder = commandContextBuilder; m_StringLocalizer = stringLocalizer; }
public PluginHelpWriter( ICommandPermissionBuilder permissionBuilder, IPermissionRegistry permissionRegistry, IOpenModPlugin plugin, ICommandStore commandStore, ICommandContextBuilder commandContextBuilder) { m_PermissionBuilder = permissionBuilder; m_PermissionRegistry = permissionRegistry; m_Plugin = plugin; m_CommandStore = commandStore; m_CommandContextBuilder = commandContextBuilder; m_PrintedCommandPermissions = new List <IPermissionRegistration>(); }
public CommandSender(IHandlerResolver handlerResolver, IEventPublisher eventPublisher, IEventFactory eventFactory, IEventStore eventStore, ICommandStore commandStore, IOptions <EventOptions> options = null) { _eventPublisher = eventPublisher; _eventFactory = eventFactory; _eventStore = eventStore; _commandStore = commandStore; _handlerResolver = handlerResolver; _supportTransactions = options?.Value.SupportTransactions ?? false; }
public void SetUp() { Directory.CreateDirectory(_path); _config = new EngineConfiguration(); _config.JournalPath = _path; _config.MaxEntriesPerJournalSegment = 10; _store = new FileCommandStore(_config); _store.Initialize(); var writer = _store.CreateJournalWriter(0); for (ulong i = 0; i < 30; i++) { writer.Write(new JournalEntry<Command>(i + 1, new TestCommandWithoutResult())); } writer.Close(); }
public DomainCommandSender(IHandlerResolver handlerResolver, IEventPublisher eventPublisher, IEventFactory eventFactory, IAggregateStore aggregateStore, ICommandStore commandStore, IEventStore eventStore, IOptions <Options> options) { _handlerResolver = handlerResolver; _eventPublisher = eventPublisher; _eventFactory = eventFactory; _aggregateStore = aggregateStore; _commandStore = commandStore; _eventStore = eventStore; _options = options.Value; }
public void SetUp() { Directory.CreateDirectory(_path); _config = new EngineConfiguration(); _config.JournalPath = _path; _config.MaxEntriesPerJournalSegment = 10; _store = new FileCommandStore(_config); _store.Initialize(); var writer = _store.CreateJournalWriter(0); for (ulong i = 0; i < 30; i++) { writer.Write(new JournalEntry <Command>(i + 1, new TestCommandWithoutResult())); } writer.Close(); }
public CommandHelp( IRuntime runtime, ICommandStore commandStore, IServiceProvider serviceProvider, IPermissionRegistry permissionRegistry, ICommandPermissionBuilder commandPermissionBuilder, ICommandContextBuilder commandContextBuilder, IOpenModStringLocalizer stringLocalizer) : base(serviceProvider) { // get global permission checker instead of scoped m_PermissionChecker = runtime.Host !.Services.GetRequiredService <IPermissionChecker>(); m_CommandStore = commandStore; m_PermissionRegistry = permissionRegistry; m_CommandPermissionBuilder = commandPermissionBuilder; m_CommandContextBuilder = commandContextBuilder; m_StringLocalizer = stringLocalizer; }
private static void InitializeENode( bool useMockCommandStore = false, bool useMockEventStore = false, bool useMockPublishedVersionStore = false, bool useMockDomainEventPublisher = false, bool useMockApplicationMessagePublisher = false, bool useMockPublishableExceptionPublisher = false) { var setting = new ConfigurationSetting(ConfigurationManager.AppSettings["connectionString"]); var assemblies = new[] { Assembly.GetExecutingAssembly() }; _enodeConfiguration = ECommonConfiguration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .UseJsonNet() .RegisterUnhandledExceptionHandler() .CreateENode(setting) .RegisterENodeComponents() .UseCommandStore(useMockCommandStore) .UseEventStore(useMockEventStore) .UsePublishedVersionStore(useMockPublishedVersionStore) .RegisterBusinessComponents(assemblies) .InitializeBusinessAssemblies(assemblies) .UseEQueue(useMockDomainEventPublisher, useMockApplicationMessagePublisher, useMockPublishableExceptionPublisher) .StartEQueue(); _commandService = ObjectContainer.Resolve<ICommandService>(); _memoryCache = ObjectContainer.Resolve<IMemoryCache>(); _commandStore = ObjectContainer.Resolve<ICommandStore>(); _eventStore = ObjectContainer.Resolve<IEventStore>(); _publishedVersionStore = ObjectContainer.Resolve<IPublishedVersionStore>(); _domainEventPublisher = ObjectContainer.Resolve<IMessagePublisher<DomainEventStreamMessage>>(); _applicationMessagePublisher = ObjectContainer.Resolve<IMessagePublisher<IApplicationMessage>>(); _publishableExceptionPublisher = ObjectContainer.Resolve<IMessagePublisher<IPublishableException>>(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(typeof(BaseTest)); _logger.Info("ENode initialized."); }
private static void InitializeENode( bool useMockCommandStore = false, bool useMockEventStore = false, bool useMockPublishedVersionStore = false, bool useMockDomainEventPublisher = false, bool useMockApplicationMessagePublisher = false, bool useMockPublishableExceptionPublisher = false) { var setting = new ConfigurationSetting(ConfigurationManager.AppSettings["connectionString"]); var assemblies = new[] { Assembly.GetExecutingAssembly() }; _enodeConfiguration = ECommonConfiguration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .UseJsonNet() .RegisterUnhandledExceptionHandler() .CreateENode(setting) .RegisterENodeComponents() .UseCommandStore(useMockCommandStore) .UseEventStore(useMockEventStore) .UsePublishedVersionStore(useMockPublishedVersionStore) .RegisterBusinessComponents(assemblies) .InitializeBusinessAssemblies(assemblies) .UseEQueue(useMockDomainEventPublisher, useMockApplicationMessagePublisher, useMockPublishableExceptionPublisher) .StartEQueue(); _commandService = ObjectContainer.Resolve <ICommandService>(); _memoryCache = ObjectContainer.Resolve <IMemoryCache>(); _commandStore = ObjectContainer.Resolve <ICommandStore>(); _eventStore = ObjectContainer.Resolve <IEventStore>(); _publishedVersionStore = ObjectContainer.Resolve <IPublishedVersionStore>(); _domainEventPublisher = ObjectContainer.Resolve <IMessagePublisher <DomainEventStreamMessage> >(); _applicationMessagePublisher = ObjectContainer.Resolve <IMessagePublisher <IApplicationMessage> >(); _publishableExceptionPublisher = ObjectContainer.Resolve <IMessagePublisher <IPublishableException> >(); _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(typeof(BaseTest)); _logger.Info("ENode initialized."); }
public DayArchiverProcessManager( IColdStorage coldStorage, IArchivableDaysRepository archivableDaysRepository, ICommandStore commandStore, TimeSpan threshold, IEventStore eventStore, Func <Guid> idGenerator ) { _commandStore = commandStore; _idGenerator = idGenerator; When <DayScheduled>(async(e, m) => { await archivableDaysRepository.Add(new ArchivableDay(e.DayId, e.Date)); }); When <CalendarDayStarted>(async(e, m) => { var archivableDays = await archivableDaysRepository.FindAll(e.Date.Add(threshold)); foreach (var day in archivableDays) { await SendCommand(day.Id, m.CorrelationId, m.CausationId); } }); When <DayScheduleArchived>(async(e, m) => { var streamName = StreamName.For <Day>(e.DayId); var events = await eventStore.LoadEvents(streamName); coldStorage.SaveAll(events); var lastVersion = await eventStore.GetLastVersion(streamName); if (lastVersion.HasValue) { await eventStore.TruncateStream(streamName, lastVersion.Value); } }); }
public DefaultCommandDispatcher(ILogger <DefaultCommandDispatcher> logger, IServiceProvider serviceProvider, ICommandStore commandStore) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } if (commandStore == null) { throw new ArgumentNullException(nameof(commandStore)); } _logger = logger; _serviceProvider = serviceProvider; _commandStore = commandStore; }
public SingleCommandFactory(ICommandStore store, [ImportMany] IEnumerable<ICommand> commands) { foreach (var c in commands) store.AddCommand(c); }
public MediatRCommandBus(IMediator mediator, ICommandStore commandStore) { this.mediator = mediator; this.commandStore = commandStore; }
public PositionalCommandParser(ICommandStore commandStore) { _commandStoreRoot = commandStore; }
public void Init() { _config = EngineConfiguration.Create().ForIsolatedTest().ForImmutability(); _commandStore = new InMemoryCommandStore(_config); _commandStore.Initialize(); }
public StoreCommands(ICommandStore store) { this.store = store; }
public IdempotentBehaviour(ICommandStore commandStore) { _commandStore = commandStore ?? throw new ArgumentNullException(nameof(commandStore)); }
public void SetCommand(ICommandStore com) { command = com; }
public ModelLoader(EngineConfiguration config, ICommandStore commandStore = null, ISnapshotStore snapshotStore = null) { _commandStore = commandStore ?? config.CreateCommandStore(); _snapshotStore = snapshotStore ?? config.CreateSnapshotStore(); }
public static JournalAppender Create(ulong nextEntryId, ICommandStore store) { return(Create(nextEntryId, store.CreateJournalWriter(nextEntryId))); }
public CommandPermissionBuilder(ICommandStore commandStore) { m_CommandStore = commandStore; }
public WebSearchCommandFactory(ICommandStore store) { store.AddCommand(new WebSearchCommand("msdn", "http://msdn.microsoft.com/", "http://social.msdn.microsoft.com/Search/en-US?query=%s")); store.AddCommand(new WebSearchCommand("StackOverflow", "http://stackoverflow.com/", "http://www.google.com/#hl=en&q=%s+site%3Astackoverflow.com")); store.AddCommand(new WebSearchCommand("Wikipedia", "http://en.wikipedia.org/", "http://en.wikipedia.org/wiki/Special:Search/%s")); store.AddCommand(new WebSearchCommand("?", "http://bing.com/", "http://www.bing.com/search?q=%s")); store.AddCommand(new WebSearchCommand("bing", "http://bing.com/", "http://www.bing.com/search?q=%s")); store.AddCommand(new WebSearchCommand("AcronymFinder", "http://www.acronymfinder.com/", "http://www.acronymfinder.com/%s.html")); store.AddCommand(new WebSearchCommand("Microsoft Mail", "https://mail.microsoft.com", "https://mail.microsoft.com")); store.AddCommand(new WebSearchCommand("gmail", "https://gmail.com", "https://gmail.com")); }
public void Init() { _config = new EngineConfiguration().ForIsolatedTest().ForImmutability(); _commandStore = new InMemoryCommandStore(_config); _commandStore.Initialize(); }
private void AssertJournalEntriesAreSequential(ICommandStore storage) { ulong expected = 1; foreach (var journalEntry in storage.CommandEntries()) { Assert.AreEqual(expected, journalEntry.Id); expected++; } }
public Help(ICommandStore commandStore, ICommandProcessor commandProcessor) { _commandStore = commandStore; _commandProcessor = commandProcessor; }
public Learn(ICommandStore commandStore) => _commandStore = commandStore;