Embedding the Play application in a user system

I would like to embed a Play-based application in my own system, similar to what I am capable of doing with Jetty. To simplify - instead of running a startscript, I would rather use a method start().

To be a little more visual, suppose I have this scenario:

  • I have a complex system based on my own code, which is responsible for messaging, event handling, etc.
  • Part of this system uses Morphia mappings (MongoDB ORM), which can be reused by the Play application.
  • Currently, the application starts Java Service Wrapper and starts as a daemon
  • I would like to expand this system by adding a Play application and all its dependencies to my own application and calling some method to launch the application using the base protocol stack (Netty)

Is this scenario possible at all?

+5
source share
1 answer

You can launch the playback server programmatically using the class NettyServer:
https://github.com/playframework/Play20/blob/2.0.4/framework/src/play/src/main/scala/play/core/server/NettyServer.scala

how

NettyServer.createServer(new File("/path/to/app"))
+3
source

All Articles