September 2018
Intermediate to advanced
398 pages
9h 43m
English
We are now ready to implement the algorithm of our BatchProducer application, which will loop repeatedly over processOneBatch. We are not going to write an integration test for it, as it merely assembles other parts that have been tested. Ideally, in a production system, you should write an end-to-end test that would start the application and connect to a fake REST server.
Here is the implementation of processRepeatedly:
def processRepeatedly(initialJsonTxs: IO[Dataset[Transaction]], jsonTxs: IO[Dataset[Transaction]]) (implicit appContext: AppContext): IO[Unit] = { import appContext._ for { beforeRead <- currentInstant firstEnd = beforeRead.minusSeconds(ApiLag.toSeconds) firstTxs <- initialJsonTxs firstStart ...
Read now
Unlock full access