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 live online training, plus books, videos, and digital content from nearly 200 publishers.