예제 #1
0
        static void Main()
        {
            RawDataPath     = ConfigurationManager.AppSettings["RawDataPath"];
            StorePath       = ConfigurationManager.AppSettings["StorePath"];
            StoreConnection = ConfigurationManager.AppSettings["StoreConnection"];

            Console.WriteLine("This is Sample3.Dump tool");
            Console.WriteLine("Using settings from the .config file");
            Console.WriteLine("  RawDataPath (put stack overflow dump here): {0}", RawDataPath);
            Console.WriteLine("  StoreDataPath: {0}", StorePath);
            Console.WriteLine("  StoreConnection: {0}", StoreConnection);

            _reader = PlatformClient.ConnectToEventStore(StorePath, "sample3", StoreConnection);
            Thread.Sleep(2000); //waiting for server initialization

            var threads = new List <Task>
            {
                Task.Factory.StartNew(DumpComments,
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness),
                Task.Factory.StartNew(DumpPosts,
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness),
                Task.Factory.StartNew(DumpUsers,
                                      TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness)
            };

            Task.WaitAll(threads.ToArray());
        }
예제 #2
0
        static void Main()
        {
            StorePath = ConfigurationManager.AppSettings["StorePath"];

            if (string.IsNullOrWhiteSpace(StorePath))
            {
                StorePath = @"C:\LokadData\dp-store";
            }

            StoreConnection = ConfigurationManager.AppSettings["StoreConnection"];
            if (string.IsNullOrWhiteSpace(StoreConnection))
            {
                StoreConnection = "http://localhost:8080";
            }

            // Use "default" container for reading/writing events
            _client = PlatformClient.ConnectToEventStore(StorePath, storeId: "default", platformServerEndpoint: StoreConnection);
            _view   = PlatformClient.ConnectToViewStorage(StorePath, "sample1-views");


            Console.WriteLine("You name:");
            _userName = Console.ReadLine();
            Console.WriteLine("Chat starting...");

            _client.WriteEvent("", Encoding.UTF8.GetBytes("|join a new user " + _userName));
            Task.Factory.StartNew(ScanChat,
                                  TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness);

            WriteColorText(_userName + ">", ConsoleColor.Green);

            _userMessage = "";

            while (true)
            {
                ConsoleKeyInfo keyInfo = Console.ReadKey();

                if (keyInfo.KeyChar != '\r')
                {
                    _userMessage += keyInfo.KeyChar;
                }
                else
                {
                    _client.WriteEvent("", Encoding.UTF8.GetBytes(string.Format("{0}|{1}", _userName, _userMessage)));
                    Console.WriteLine();
                    WriteColorText(_userName + ">", ConsoleColor.Green);
                    _userMessage = "";
                }
            }
        }
예제 #3
0
 public void UseEventStore(string storeId = "default")
 {
     EventStores = PlatformClient.ConnectToEventStore(Options.StoreLocation, storeId, ClientHttpBase);
 }