public OrderModule() { Get["/eventstream/orderdomain/order/{startEventNumber},{endEventNumber}"] = parameters => { long startEventNumber = long.Parse(parameters.startEventNumber); long endEventNumber = long.Parse(parameters.endEventNumber); EventRange eventRange = new EventRange(startEventNumber, endEventNumber, TestStreamRepository.EventCount); Console.WriteLine($"/eventstream/orderdomain/order/: {eventRange.Start} to {eventRange.End}"); using (NpgsqlConnection dbConnection = new NpgsqlConnection(ConnectionString)) { TransportMessage m = OrderRepository.GetTransportMessage(dbConnection, eventRange); return(Response.AsJson(m)); } }; Get["/eventstream/orderdomain/order"] = parameters => { throw new NotImplementedException("Not yet implemented"); }; }
public TestStreamModule() { Get["/teststream/{startEventNumber},{endEventNumber}"] = parameters => { long startEventNumber = long.Parse(parameters.startEventNumber); long endEventNumber = long.Parse(parameters.endEventNumber); EventRange eventRange = new EventRange(startEventNumber, endEventNumber, TestStreamRepository.EventCount); Console.WriteLine($"teststream: {eventRange.Start} to {eventRange.End}"); TransportMessage result = TestStreamRepository.GetTransportMessage(eventRange); return(Response.AsJson(result)); }; Get["/teststream"] = parameters => { EventRange eventRange = TestStreamRepository.GetCurrent(); Console.WriteLine($"teststream(url unspecified numbers): {eventRange.Start} to {eventRange.End}"); var result = TestStreamRepository.GetTransportMessage(eventRange); return(Response.AsJson(result)); }; }