Skip to content

Instantly share code, notes, and snippets.

View sebastianharko's full-sized avatar

lteqgt sebastianharko

  • Netherlands
View GitHub Profile
@sebastianharko
sebastianharko / persistence-plugin-configs.sc
Last active July 13, 2017 17:33
Multiple persistence plugin configurations
// Run this in the Ammonite REPL (http://ammonite.io)
import $ivy.`com.typesafe.akka::akka-persistence:2.5.3`
import $ivy.`com.typesafe.akka::akka-persistence-cassandra:0.54`
import akka.actor.{ActorSystem, Props}
import akka.event.LoggingReceive
import akka.persistence.PersistentActor
import com.typesafe.config.ConfigFactory
@sebastianharko
sebastianharko / akkahttpmarshaller.scala
Created September 5, 2018 03:55
use different marshaller
bject WebServer extends Json4sSupport {
def main(args: Array[String]) {
implicit val serialization = json4s.jackson.Serialization // or native.Serialization
implicit val formats = DefaultFormats
implicit val system = ActorSystem("my-system")
implicit val materializer = ActorMaterializer()
// needed for the future flatMap/onComplete in the end
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshalling.{Marshaller, PredefinedToEntityMarshallers, ToEntityMarshaller}
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.model.{HttpRequest, MediaTypes}
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import de.heikoseeberger.akkahttpjson4s.Json4sSupport
import org.json4s
import org.json4s.DefaultFormats
@sebastianharko
sebastianharko / akkahttpmarshaller.scala
Created September 5, 2018 05:57
with custom directive
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.marshalling.{Marshaller, PredefinedToEntityMarshallers, ToEntityMarshaller}
import akka.http.scaladsl.model.headers.RawHeader
import akka.http.scaladsl.model.{HttpRequest, MediaTypes}
import akka.http.scaladsl.server.Directives._
import akka.stream.ActorMaterializer
import de.heikoseeberger.akkahttpjson4s.Json4sSupport
import org.json4s
import org.json4s.DefaultFormats