Exemplo n.º 1
0
        static void Main(string[] args)
        {
            _eventStream = EventStreamBuilder.Configure(c =>
            {
                c.WithPersistantStore(_store);
                c.ScanAssemblyWithType <Program>();
            })
                           .BuildWithProcessor(TimeSpan.FromMinutes(5));

            Console.WriteLine("Streaming events...");

            _eventStream
            .Process(new SensorOnline("CPU"))
            .Process(new SensorDataReceived(45.3m))
            .Process(new SensorDataReceived(42.6m))
            .Process(new SensorDataReceived(40.1m))
            .Process(new SensorDataReceived(40.1m))
            .Process(new SensorDataReceived(40.1m))
            .Process(new SensorDataReceived(39m))
            .Process(new SensorOffline())
            .Process(new SensorOnline("CPU"))
            .Process(new SensorDataReceived(40.5m))
            .Process(new SensorOffline());

            _eventStream.Shutdown();

            Console.WriteLine("Done receiving events");

            var eventsStored = _store.GetEvents();

            Console.WriteLine($"{eventsStored.Count()} events written to persistance store");
        }
 internal ServerSentEventsClient(
     IEventStreamClient eventStreamClient,
     IEventStreamProcessor eventStreamProcessor,
     ILoggerFactory loggerFactory
     )
 {
     m_logger               = loggerFactory.CreateLogger <ServerSentEventsClient>();
     m_eventStreamClient    = eventStreamClient;
     m_eventStreamProcessor = eventStreamProcessor;
 }
Exemplo n.º 3
0
        public EventStoreRepository(IEventStore eventStore,
                                    IEventStreamProcessor <TAggregateRoot, TAggregateRootState> eventStreamProcessor,
                                    IGuidGenerator guidGenerator)
        {
            Contract.Requires(eventStore != null);
            Contract.Requires(eventStreamProcessor != null);
            Contract.Requires(guidGenerator != null);

            _eventStore           = eventStore;
            _eventStreamProcessor = eventStreamProcessor;
            _guidGenerator        = guidGenerator;
        }
 public void Setup()
 {
     m_sut = new EventStreamProcessor(new MessageParser());
 }