September 2018
Intermediate to advanced
398 pages
9h 43m
English
We now have all the building blocks to create our application. Create a new object, coinyser.StreamingProducerApp, and type the following code:
package coinyserimport cats.effect.{ExitCode, IO, IOApp}import com.pusher.client.Pusherimport StreamingProducer._import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord}import scala.collection.JavaConversions._object StreamingProducerApp extends IOApp { val topic = "transactions" val pusher = new Pusher("de504dc5763aeef9ff52") val props = Map( "bootstrap.servers" -> "localhost:9092", "key.serializer" -> "org.apache.kafka.common.serialization.IntegerSerializer", "value.serializer" -> "org.apache.kafka.common.serialization.StringSerializer") def run(args:
Read now
Unlock full access