Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python framework as an alternative for "Java + OSGi" combination

I'm thinking about Python and C/C++ combination to replace the original concept about OSGi + Java + JNI + C/C++ in our SW architecture.

I definitely don't need to replace all features of such OSGi frameworks as Felix or Equinox.

What I really will need in my Python code:

  1. Enabler of modularity for the application layer
  2. Component-based framework for applications
  3. Central registry of services/components
  4. Very lightweight framework, it will run on embedded devices (though pretty enough of RAM)

Can you please advise on such Python framework?

like image 338
Oleg Puzanov Avatar asked Oct 19 '25 08:10

Oleg Puzanov


2 Answers

I think much of what OSGi offers is closely related to the architecture of Java: its class loaders and type safety. Implementing a service registry should not be too hard but managing it with the accuracy of OSGi will be virtually impossible. Obviously the power of multiple namespace that OSGi offers will not work in Python unless you move the modules into separate processes which will require more expensive inter process communication for inter module communication. You could start with Apache Celix, which is native based but I have similar doubts about its utility since native code does not provide a lot of information about its dependencies.

A more general solution is the original idea of Universal OSGi. In this model you keep the OSGi framework as it is for the deployment and management. However, you create handler bundles that can map a bundle written with other languages. E.g. a Python handler or C++ native. The handlers would map a native service registry model to the OSGi service registry. This is surprisingly easy to do since the OSGi service registry is properly evented. The native handlers would map the bundle events like start/stop to instruct the operating system to start/stop the native code.

like image 113
Peter Kriens Avatar answered Oct 21 '25 23:10

Peter Kriens


Peter already mentioned Apache Celix. Might be well worth to check it out. Part of Celix is a Remote Service Admin (RSA) implementation, making it possible to use it in a distributed environment. Eventually this implementation will also make it possible to communicate with a Java based OSGi framework, making Celix+RSA an alternative for JNI. This has the additional benefit that the native and java code don't share the same process. If one end runs into a problem, the other end still stays running.

In line with Celix, you could as well look at Native-OSGi, this is an effort of Celix and some C++ OSGi like frameworks (CTK Plugin Framework and nOSGi) to come up with a combined approach for Native OSGi like implementations. This includes stuff like a well defined API, bundle format, code sharing etc.

Looking at your requirements I thinks Celix and Native-OSGi might be a good fit.

like image 32
Alexander Avatar answered Oct 21 '25 23:10

Alexander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!