Testing processOneBatch

Our function will need a few configuration parameters and implicit values. To keep our signature tidy, we are going to put them in a class. Create a new class, coinyser.AppContext:

class AppContext(val transactionStorePath: URI)                (implicit val spark: SparkSession,                 implicit val timer: Timer[IO])

AppContext contains the target location for the Parquet files, the SparkSession object, and a Timer[IO] object that is required by cats.effect when we need to call IO.sleep.

Then declare the processOneBach function in BatchProducer:

def processOneBatch(fetchNextTransactions: IO[Dataset[Transaction]],                    transactions: Dataset[Transaction],                    saveStart: Instant,                    saveEnd: Instant)(implicit appCtx: AppContext): IO[(Dataset[Transaction ...

Get Scala Programming Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.