playframework

Cannot create wsClient after creating mock server via RoutingDsl  #angularjs #reactjs

  • When creating the server, the Akka system is started.
  • Module enabled += settings.
  • So I guess Play’s recommendation of using a mock server necessarily uses the Akka system.
  • Akka was started when I did Server.forRouter(router) .
  • The port number needs to be unique for each actor system on the same machine even if the actor systems have different names.

When creating the server, the Akka system is started. Logs mention some binding to 127.0.0.1:2551. I believe it’s Netty, which is used by Akka.

@ng_real_ninja: Cannot create wsClient after creating mock server via RoutingDsl #angularjs #reactjs

I’m following this tutorial on mocking an external web service:

Router router = new RoutingDsl().build(); Server server = Server.forRouter(router); WSClient ws = WS.newClient(server.getHttpPort());

appName = myApplication akka { log-config-on-start = true actor { provider = “cluster” } actor-system = ${appName} cluster { metrics { enabled = off native-library-extract-folder = ${user.dir}/target/native } pub-sub { name = distributedPubSubMediator role = “” routing-logic = broadcast gossip-interval = 1s removed-time-to-live = 120s max-delta-elements = 3000 use-dispatcher = “” } seed-nodes = [ “akka.tcp://”${appName}”@127.0.0.1:2551” ] } extensions = [ “akka.cluster.metrics.ClusterMetricsExtension”, “akka.cluster.pubsub.DistributedPubSub” ] remote { log-remote-lifecycle-events = on enabled-transports = [“akka.remote.netty.tcp”] # needed ? netty.tcp { hostname = “127.0.0.1” port = 3551 } } } play.crypto.secret = “mySecret” play.modules { enabled += libs.clients.playaero.Module enabled += libs.clients.playelastic.Module enabled += libs.clients.playfacebook.Module enabled += controller.akka.Module enabled += model.Module enabled += settings.Module } play.i18n { langs = [ “en” ] }

The port number needs to be unique for each actor system on the same machine even if the actor systems have different names. This is because each actor system has its own networking subsystem listening for connections and handling messages as not to interfere with other actor systems.

playframework