O'Reilly logo

Scala Programming Projects by Nicolas Jorand, Mikael Valot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing BatchProducerApp

Finally, all we need to do is create an application that will call processRepeatedly with the right parameters.

Create a new class, coinyser.BatchProducerApp, in src/main/scala and type the following:

package coinyserimport java.io.{BufferedReader, InputStreamReader}import java.net.{URI, URL}import cats.effect.{ExitCode, IO, IOApp}import coinyser.BatchProducer.{httpToDomainTransactions, jsonToHttpTransactions}import com.typesafe.scalalogging.StrictLoggingimport org.apache.spark.sql.{Dataset, SparkSession}import scala.io.Sourceclass BatchProducerApp extends IOApp with StrictLogging {  implicit val spark: SparkSession =   SparkSession.builder.master("local[*]").getOrCreate()  implicit val appContext: AppContext 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required