This file contains 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
echo "HI" |
This file contains 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
create table simple ( | |
key_one text, | |
key_two int, | |
data text, | |
PRIMARY KEY(key_one, key_two) | |
); |
This file contains 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
libraryDependencies += "mysql" % "mysql-connector-java" % "8.0.15" |
This file contains 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 processUserAdded(addEvent: AddEvent): Future[Done] = { | |
session.withConnection { connection => | |
val statement = connection.prepareStatement("INSERT INTO user (orgId, email, name) VALUES (?, ?, ?)") | |
statement.setInt(1, addEvent.user.orgId) | |
statement.setString(2, addEvent.user.email) | |
statement.setString(3, addEvent.user.name) | |
statement.execute() | |
}.map(_ => Done) | |
} |
This file contains 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 createTable: Future[Done] = { val query = | |
""" | |
|CREATE TABLE IF NOT EXISTS user ( | |
|orgId INT NOT NULL, | |
|email VARCHAR(64) NOT NULL, | |
|name VARCHAR(64) NOT NULL, | |
|PRIMARY KEY (orgId)) | |
""".stripMargin | |
session.withConnection(_.prepareStatement(query).execute()).map(_ => Done) |
This file contains 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
override def buildHandler(): ReadSideProcessor.ReadSideHandler[Event] = { | |
new ReadSideHandler[Event] { | |
override def globalPrepare(): Future[Done] = createTable | |
override def handle(): Flow[EventStreamElement[Event], Done, NotUsed] = { | |
Flow[EventStreamElement[Event]].mapAsync(4) { eventElement => | |
eventElement.event match { | |
case addEvent: AddEvent => processAdded(addEvent) | |
case updateEvent: UpdateEvent => processUpdated(updateEvent) |
This file contains 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
play.application.loader = com.knoldus.user.impl.UserLoader | |
jdbc-defaults.slick { | |
profile = "slick.jdbc.MySQLProfile$" | |
jndiName = DefaultDS | |
} | |
db.default { | |
driver = "com.mysql.cj.jdbc.Driver" | |
url = "jdbc:mysql://localhost:3306/db?autoReconnect=true" |
This file contains 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
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonInclude$Value | |
at com.fasterxml.jackson.databind.cfg.MapperConfig.(MapperConfig.java:45) | |
at com.fasterxml.jackson.databind.ObjectMapper.(ObjectMapper.java:535) | |
at com.fasterxml.jackson.databind.ObjectMapper.(ObjectMapper.java:452) | |
at com.allianz.cmis.util.ApacheHttpClientGet.main(ApacheHttpClientGet.java:65) | |
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.annotation.JsonInclude$Value | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) | |
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) | |
at java.security.AccessController.doPrivileged(Native Method) | |
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) |
This file contains 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
WARN akka.actor.ActorSystemImpl - Illegal request, responding with status '400 Bad Request': Request is missing required `Host` header: Cannot establish effective URI of request, request has a relative URI and is missing a `Host` header; consider setting `akka.http.server.default-host-header` |
This file contains 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
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Product$class | |
at play.api.Configuration.<init>(Configuration.scala:175) | |
at play.api.Configuration$.load(Configuration.scala:100) | |
at play.core.server.ProdServerStart$.readServerConfigSettings(ProdServerStart.scala:86) | |
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:40) | |
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:25) | |
at play.core.server.ProdServerStart.main(ProdServerStart.scala) | |
Caused by: java.lang.ClassNotFoundException: scala.Product$class | |
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) | |
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) |