This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kafka | |
import java.util.Properties | |
import org.apache.kafka.clients.producer.{KafkaProducer, ProducerRecord} | |
import scala.io.StdIn | |
object producing extends App{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kafka | |
import java.util.{Collections, Properties} | |
import java.util | |
import org.apache.kafka.clients.consumer.KafkaConsumer | |
import org.apache.kafka.common.TopicPartition | |
import org.apache.log4j.Logger | |
import scala.collection.JavaConverters._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cassandra | |
import com.datastax.spark.connector.rdd.CassandraTableScanRDD | |
import org.apache.spark.{SparkConf, SparkContext} | |
object battles { | |
case class Battle( | |
battle_number: Option[Integer], | |
year: Option[Integer], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val Snapshots = "Snapshots" at "url to repo " | |
val Releases = "Releases" at "url to repo " | |
lazy val sharedSettings = Seq( | |
scalaVersion := "2.12.6", | |
version := "0.1.6", | |
resolvers ++= Seq( | |
Snapshots, | |
Releases, | |
"Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Animal { | |
def speakLikeAnimal : Unit | |
//some other method for animals | |
} | |
case class Cat (name : String , sound : String) extends Animal{ | |
override def speakLikeAnimal: Unit = println(s"I am $name and the sound i make is $sound") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait HumanTendency[A]{ | |
def makeHumanLike(a : A) : String | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val humanLike = new HumanTendency[Parrot] { | |
override def makeHumanLike(a: Parrot): String = s"I am ${a.name}, the sound i make is ${a.sound},and i can talk like a human :) " | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def speakLikeHuman(p :Parrot)(implicit humanTendency: HumanTendency[Parrot]) : String = { | |
humanTendency.makeHumanLike(p) | |
} | |
println ( speakLikeHuman(parrot) ) // prints out ---------> I am Casey, the sound i make is prrrrr,and i can talk like a human :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class ToParrot( p : Parrot){ | |
def speakLikeHuman(implicit humanlike : HumanTendency[Parrot]) : String = { | |
humanlike.makeHumanLike(p) | |
} | |
} | |
//let us create our closed model object type Parrot | |
val parrot = Parrot("Casey", "prrrrr") | |
//closed object type Cat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(messageGateway ? SendMessageToClientRequest ( | |
id = id, | |
phoneNumber = pNumber, | |
msg = message | |
)).mapTo[SendMessageToClientResponse] onComplete { | |
case Success(res) => res match { | |
case SendMessageToClientResponse(true) => | |
currentSender ! SendCustomMessageResponse(true) | |
case SendMessageToClientResponse(false) => | |
currentSender ! SendCustomMessageResponse(false) |
OlderNewer