public void Setup() { var pages = new MemoryPageReaderWriter(); var checkpoint = new MemoryCheckpointReaderWriter(); Writer = new MessageWriter(pages, checkpoint); Reader = new MessageReader(checkpoint, pages); CheckpointReader = checkpoint; PageWriter = pages; Writer.Init(); }
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; } }
public InMemStream() { Pages = new MemoryPageReaderWriter(); Pages.Init(); Checkpoint = new MemoryCheckpointReaderWriter(); Writer = new MessageWriter(Pages, Checkpoint); }