示例#1
0
        static void Main(string[] args)
        {
            // configure the system
            var store = @"C:\LokadData\dp-store";
            // scan "default" event container
            var reader = PlatformClient.ConnectToEventStoreAsReadOnly(store, storeId: "default");
            var views  = PlatformClient.ConnectToViewStorage(store, "sample2-views");

            // Load view, in case this console continues previous work
            var data = views.ReadAsJsonOrGetNew <Sample2Data>(ViewName);

            // print it for debug purposes
            PrintDataToConsole(data, true);

            // this process runs incrementally until stopped
            while (true)
            {
                try
                {
                    ProcessNextIncrementOfEventsOrSleep(data, reader, views);
                }
                catch (Exception ex)
                {
                    // print and sleep on error
                    Console.WriteLine(ex);
                    Thread.Sleep(1000);
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            var store = PlatformClient.ConnectToEventStoreAsReadOnly(PlatformPath, "sample3");
            var views = PlatformClient.ConnectToViewStorage(PlatformPath, Conventions.ViewContainer);

            var threads = new List <Task>
            {
                Task.Factory.StartNew(() => TagProjection(store, views),
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness),
                Task.Factory.StartNew(() => CommentProjection(store, views),
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness),
                Task.Factory.StartNew(() => UserCommentsPerDayDistributionProjection(store, views),
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness)
            };

            Task.WaitAll(threads.ToArray());
        }