-
Notifications
You must be signed in to change notification settings - Fork 39
Configuration
All you need to configure is the Command Processor, you use it to configure every aspect of Cirqus. The fluent configuration API is very extensive, but you don't need to know every possible configuration option to get started.
The configuration of Cirqus has to happen exactly once and the processor should then globally be available. One possibility is to use dependency injection to make this happen. In a web application, the configuration is best put in Application_Start
in Global.asax.cs or a method called by Application_Start
.
var processor = CommandProcessor.With()
.EventStore(c => c.UseSqlServer(connectionStringOrConnectionStringName, eventsTableName))
.EventDispatcher(c => c.UseViewManagerEventDispatcher(viewManagers))
.Create();
In the example above the events are stored in SQL Server. The event store configuration requires 2 parameters:
- the connection string or the name of the connection string for the database
- the name of the table contains the events
Cirqus will create the table itself if it doesn't exist.
The event dispatcher requires an array of all the view managers you will be using.
The Create
method finished the configuration and starts a thread for every event dispatcher (just one in the example above). The default catchup time is 1000 ms. This means that every second, the second thread checks for new events in the event store and dispatches them to all the view managers.