Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play framework and OSGI

Is it possible to integrate play framework with OSGI to create plugable components? Did someone try it?

like image 815
adelarsq Avatar asked Jul 07 '11 00:07

adelarsq


People also ask

What is OSGi framework?

The OSGi (Open Service Gateway Initiative) specification is a Java framework for developing and deploying modular software programs and libraries.

Is OSGi a Microservice?

Even though many might argue that OSGi is an alternative to microservices, considering that it splits a typical Java application into a set of modules, the idea of using OSGi in combination with microservices is in fact not new and has been already successfully applied.

Is Play Framework MVC?

A play application follows the MVC architectural pattern applied to the Web architecture. This pattern splits the application into separate layers: the Presentation layer and the Model layer. The Presentation layer is further split into a View and a Controller layer.

What is OSGi in simple terms?

Simply said, OSGi is a dynamic module system for Java. It defines means to install, uninstall, update, start and stop modules. Those modules are called bundles, but are, in their simplest form, actually Java jar files with a special Manifest.


2 Answers

If you mean "create Play modules with OSGi", then no, it's not supported

If you mean "deploy Play as an OSGi module" then no, it's not supported

And to be fair, there's no reason to push its support. You can read these thoughts from Spring founder on OSGi, as an example. OSGi would add extra complexity to Play, while the main aim of Play is to be a rapid development platform, simple to use, removing some Java conventions (like Sessions). It would kind of defeat the purpose.

like image 68
Pere Villega Avatar answered Nov 09 '22 11:11

Pere Villega


If we're discussing Play 2 then it's definitely worth acknowledging that an important and integral part of Play now is Akka, which could be seen as an alternative to OSGi. Philosophically I think Akka has a lot in common with the core principles of Play and Scala (a functional, stateless, NIO approach), while OSGi is more aligned with the Java EE/Spring camp.

That's not to say that Akka and OSGi are wholly mutually-exclusive: Akka's documentation suggests you can deploy Akka as an OSGi bundle and create some mutant app which has Akka actors firing up via an OSGi bundle.

But to answer the question, no, Play doesn't do OSGi, but it very much does do Akka.

like image 42
spume Avatar answered Nov 09 '22 11:11

spume