Skip to content

Instantly share code, notes, and snippets.

View harmeetsingh0013's full-sized avatar

Harmeet Singh(Taara) harmeetsingh0013

View GitHub Profile
package core.dao
import scala.concurrent.Future
import play.api.Logger
import reactivemongo.core.commands.LastError
import reactivemongo.core.errors.DatabaseException
import core.db.MongoHelper

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Full - Stack Trace
- should add new user *** FAILED ***
[info] akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://application/user/jdbcCreateTables-singletonProxy#-322546342]] after [20000 ms]. Sender[null] sent message of type "com.lightbend.lagom.internal.persistence.cluster.ClusterStartupTaskActor$Execute$".
[info] at akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala:604)
[info] at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:126)
[info] at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:601)
[info] at scala.concurrent.BatchingExecutor$class.execute(BatchingExecutor.scala:109)
[info] at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:599)
[info] at akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(LightArrayRevolverScheduler.scala:329)
[info] at akka.actor.LightArrayRevolverScheduler$$anon$4.executeBucket$1(LightArrayRevolverScheduler.scala:280)
CREATE TABLE public.search_keys
(
id uuid NOT NULL,
key character varying(50),
CONSTRAINT search_keys_pkey PRIMARY KEY (id)
)
CREATE TABLE public.repo_info
(
id integer NOT NULL,
lazy val slickVersion = "3.2.0"
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick" % slickVersion,
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion,
"com.typesafe.slick" %% "slick-codegen" % slickVersion % "compile",
"org.postgresql" % "postgresql" % "9.4.1212",
"com.typesafe.slick" %% "slick-testkit" % "3.2.0" % "test"
)
package com.knoldus.github.repo
// AUTO-GENERATED Slick data model
/** Stand-alone Slick data model for immediate use */
object Tables extends {
val profile = slick.jdbc.PostgresProfile
} with Tables
/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
trait Tables {
credentials += Credentials(Path.userHome / ".lightbend" / "commercial.credentials")
resolvers += Resolver.url("lightbend-commercial",
url("https://repo.lightbend.com/commercial-releases"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.lightbend.cinnamon" % "sbt-cinnamon" % "2.4.2")
val akkaVersion = "2.4.17"
lazy val `akka-cinammon` = project in file(".") enablePlugins (Cinnamon)
// Add the Cinnamon Agent for run and test
cinnamon in run := true
cinnamon in test := true
// Set the Cinnamon Agent log level
cinnamonLogLevel := "INFO"
cinnamon.akka {
actors {
"/user/*" {
report-by = instance
}
}
}
cinnamon.chmetrics {
reporters += "console-reporter"
}
package com.harmeetsingh13.actors
import akka.actor.{Actor, ActorLogging, ActorSystem, Props}
/**
* Created by Harmeet Singh(Taara) on 1/7/17.
*/
class HelloWorldActor extends Actor with ActorLogging {
override def receive: Receive = {