Пример #1
0
		static async Task RunAsync() {
			using (var client = new Client("http://127.0.0.1:8001", Constants.DefaultLogin, Constants.DefaultPassword)) {
				
				// consumer
				var checkpoint = new MemoryCheckpointReaderWriter();
				var consumer = new ConsumerSample(checkpoint, client);

				var task = Task.Run(() => consumer.Run(CancellationToken.None));

				for (int i = 0; i < 10; i++) {
					var message = Message.Create("test", new byte[20]);

					var response = await client.PostMessagesAsync("teststream", new[] { message });
					Console.WriteLine(response.Position);

					await Task.Delay(1000);

				}

				await task;
			}
		}
Пример #2
0
        static async Task RunAsync()
        {
            using (var client = new CloudClient("http://127.0.0.1:8001", Constants.DefaultLogin, Constants.DefaultPassword)) {
                // consumer
                var checkpoint = new MemoryCheckpointReaderWriter();
                var consumer   = new ConsumerSample(checkpoint, client);

                var task = Task.Run(() => consumer.Run(CancellationToken.None));

                for (int i = 0; i < 10; i++)
                {
                    var message = Message.Create("test", new byte[20]);

                    var response = await client.PostMessagesAsync("teststream", new[] { message });

                    Console.WriteLine(response.Position);

                    await Task.Delay(1000);
                }

                await task;
            }
        }