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 com.softwaremill.mqperf | |
import com.softwaremill.mqperf.config.TestConfigOnS3 | |
import com.softwaremill.mqperf.mq.Mq | |
object Receiver extends App { | |
new TestConfigOnS3().whenChanged { testConfig => | |
println(s"Starting test (receiver) with config: $testConfig") | |
val mq = Mq.instantiate(testConfig) |
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 com.softwaremill.mqperf.mq | |
import com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient | |
import com.amazonaws.services.sqs.AmazonSQSAsyncClient | |
import scala.collection.JavaConverters._ | |
import com.amazonaws.services.sqs.model.{DeleteMessageRequest, ReceiveMessageRequest, SendMessageBatchRequestEntry} | |
import com.softwaremill.mqperf.config.AWSCredentialsFromEnv | |
import com.amazonaws.regions.{Region, Regions} | |
class SqsMq(configMap: Map[String, String]) extends Mq { |
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 serverLocator = { | |
val nettyParams = new java.util.HashMap[String, Object]() | |
nettyParams.put(TransportConstants.HOST_PROP_NAME, "localhost") | |
nettyParams.put(TransportConstants.PORT_PROP_NAME, "5445") | |
val sl = HornetQClient.createServerLocatorWithHA( | |
new TransportConfiguration(classOf[NettyConnectorFactory].getName, nettyParams)) | |
sl.setConfirmationWindowSize(1048576) |
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
/* | |
A proposition on how classifiers can be implemented in MacWire. Based on @milessabin's https://gist.github.com/milessabin/89c9b47a91017973a35f | |
*/ | |
// Infrastructure: would come in the library | |
// note that no changes in the macro are necessary. The qualifiers are purely type-based | |
type Tag[U] = { type Tag = U } | |
type @@[T, U] = T with Tag[U] | |
type Tagged[T, U] = T with Tag[U] | |
implicit class Tagger[T](t: T) { |
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 carForm(removeAction: Car => ActionResult[Car]) = form[Car](f => List( | |
f.field(_.make).possibleValues(_ => carMakesAndModels.keys.toList).label("Make"), | |
// etc. | |
// trait Form[T] { def action(T => ActionResult[T]): Row[T] } | |
f.action(removeAction).label("Delete") | |
)) | |
val personForm = form[Person](f => List) | |
f.field(_.firstName).label("label_person_firstname"), | |
// etc. |
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
new SuplerForm(document.getElementById("container"), { | |
field_options: { | |
"age": { | |
// define render hint on frontend | |
"render_hint": "number" | |
}, | |
"dateOfBirth": { | |
"after_render": function(inputElement, containerElement) { | |
$(inputElement).datepicker(); | |
} |
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
import akka.actor.{Props, ActorSystem, Actor} | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import scala.concurrent.duration._ | |
object Testing extends App { | |
case class Inc(n: Int) | |
class CounterActor extends Actor { | |
private var state = 0 |
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 rejectionHandler = RejectionHandler.default | |
def logDuration(inner: Route): Route = { ctx => | |
val start = System.currentTimeMillis() | |
// handling rejections here so that we get proper status codes | |
val innerRejectionsHandled = handleRejections(rejectionHandler)(inner) | |
mapResponse { resp => | |
val d = System.currentTimeMillis() - start | |
logger.info(s"[${resp.status.intValue()}] ${ctx.request.method.name} ${ctx.request.uri} took: ${d}ms") | |
resp | |
}(innerRejectionsHandled)(ctx) |
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
Dec 04 08:14:57: 04/Dec/15 07:14:56.764 [app-akka.actor.default-dispatcher-6498] ERROR akka.stream.impl.fusing.ActorGraphInterpreter - Error during postStop in [akka.http.impl.engine.server.HttpServerBluePrint$WebsocketMerge@3e3fce20] | |
Dec 04 08:14:57: java.lang.IllegalArgumentException: requirement failed: Value wasn't set yet | |
Dec 04 08:14:57: at scala.Predef$.require(Predef.scala:219) ~[app.jar:0.1-SNAPSHOT] | |
Dec 04 08:14:57: at akka.http.impl.util.StreamUtils$OneTimeWriteCell.value(StreamUtils.scala:240) ~[app.jar:0.1-SNAPSHOT] | |
Dec 04 08:14:57: at akka.http.impl.engine.server.HttpServerBluePrint$$anon$7.installHandler(HttpServerBluePrint.scala:351) ~[app.jar:0.1-SNAPSHOT] | |
Dec 04 08:14:57: at akka.http.impl.engine.server.HttpServerBluePrint$$anonfun$apply$1$$anonfun$17.apply(HttpServerBluePrint.scala:142) ~[app.jar:0.1-SNAPSHOT] | |
Dec 04 08:14:57: at akka.http.impl.engine.server.HttpServerBluePrint$$anonfun$apply$1$$anonfun$17.apply(HttpServerBluePrint.scala:142) ~[app.jar:0.1-SNAPSHOT] | |
Dec 0 |
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 com.softwaremill.akka | |
import java.time._ | |
import akka.actor.ActorSystem | |
import akka.stream.ActorMaterializer | |
import akka.stream.scaladsl.Source | |
import scala.collection.mutable | |
import scala.concurrent.Await |