Java Open Source Framework for Service Management - java

Working on a Java-based large distributed system, so there will be multiple services running across multiple machines .....
Looking for an open source framework to be able to manage these services(e.g. start/stop a service, install a new a service remotely etc.)
Apache Karaf seems to be a good choice, but underneath it uses apache felix (an OSGi reference implementation) bundle which I have a hard time to really understand. In particular, it seems to be easy to define and register a service in felix, but how do you invoke such a service remotely? Do you need to have a separate RPC mechanism to achieve that? There seems to be very few links describe it. In general how do people use OSGi? Is Apache felix out of date?
Any other framework that can be used to manage services assuming I will have my own RPC layer (say RMI based or Netty based)?

I guess you have to specify the way you define a service.
There are services, like remote services that use RPC mechanism, for example EJB remote calls.
Another way to define services is to talk of Web-Services, either using SOAP(XML) or JAXRS(JSON) as transport protocol. And there is the definition of services in OSGi which just means a separation of API (service definition) and implementation. As sum-up you could define OSGi as a SOA for Applications within the same VirtualMachine. (it gives much more, but this is one way to look at it from a service perspective)
Apache Karaf is a OSGi server that is comparable to a Application Server, only it works for OSGi applications. It brings a lot of convenience technologies on top of a choosable OSGi framework. That would be either Apache Felix or Eclipse Equinox. Both are OSGi frameworks that provide the basic OSGi infrastructure - SOA in the same JVM.
Now there are a lot of other benefits of it, like starting and stoping services, updating services.
Taking the RPC into account this can easily be achieved, by combining OSGi-Services with CXF for example. It can easily be configured to export an OSGi service as CXF service. (this is very Karaf/CXF specific)
Apache Karaf itself also supports clustering with Apache Karaf Cellar, which also provides a DOSGi service for easier communication of services across cluster groups. DOSGi stands for Distributed OSGi, which can also be achieved by using CXF and much other implementations.
Apache Felix and OSGi in general are far away of being out-of-date. A lot of Java EE Application servers use OSGi as their underlying technology to be modular and have a smaller footprint.
That would be GlassFish, Websphere, Geronimo etc...

Related

Difference between Application servers and standalone frameworks

I would like you guys to give me some feedback, on my understanding about the
difference between Application Servers such as JBoss and frameworks such as Axis and CXF.
CXF is a standalone, web-app based framework that
implements JAX-RS, JAX-WS API wich, in turn, are part of the
larger API set of JEE.
Being a web-app based implementation, it
can only be used to host "SOAP on HTTP" services even if the
standard JAX-WS defines other possible channels for SOAP
messages,such as SMTP.
Application servers,such as JBOSS, instead implement JAX-WS as well as all the other JEE APIs in a more "native" and direct way, so,for example, they can be used to host also SOAP on SMTP services.
Both AS and standalone frameworks such as CXF and AXIS make
extensive use of Inversion of control.
Application Servers, such as Jboss, can be thought as composed by a
set of frameworks that implement all the JEE stack API.
Please take some time to correct/enhance the above statements.
Thanks

how to exchange message b/w components in apache servicemix

ESB experts, need some help. I am stuck in apache servicemix(v 4.5.3). The scenario is the communication between our enterprise applications including one is web application already executing on tomcat. Two applications are main applications, and last one is Vert.x server(used for push notification). They all are executing on different machines.
The problem is how to configure servicemix, that I can use as a ESB and let applications to communicate.
What I have done till now:
1. Deployed(war) web application as a bundle in servicemix in deploy folder.
Is this the right approach for communication b/w independent applications? What I am thinking is don't deploy any war/jar in servicemix, just use as a esb. I mean, is this the necessity to deploy applications in servicemix to let communication?If yes, than how will I achieve this, I mean I am using distributed environment and servicemix is running on separate machine ?
Please guide me. I am novice in esb world.Feel free to ask if any query.
Yes you need to deploy applications in ServiceMix that has the logic how to integrate and your business logic.
ServiceMix is using Apache Karaf as the container, so its basically just an application server (OSGi based).
To build applications that integrate you very often should use Apache Camel as its comes out of the box with ServiceMix. So I suggest to take a look at and learn more about Apache Camel, and how to use that to integrate.
There is another question here on stackoverflow that can help your get started learning about Apache Camel: What exactly is Apache Camel?
Apache ServiceMix / Karaf supports deploying WAR files, and also OSGi bundles. The latter is more often used. And there is some WAR files which may not work, if they use some libraries that do not work well in an OSGi environment.

Is Glassfish an Enterprise Service Bus (ESB)?

I was arguing with a coworker about ESBs. I mentioned that Glassfish is an ESB as it manages database transactions, provides SOAP messages, and messaging systems through JMS. He disagreed and said that Oracle Enterprise Service Bus is an ESB whereas Glassfish isn't. I asked him what features make an ESB and he couldn't respond.
What is Glassfish lacking that prevent it from being an ESB?
Glassfish has a bunch of the components of an ESB, but what it is specifically lack in the orchestration component. The orchestration is managing the "wiring" of the various services to each other. GF has all of the capability in terms of managing the endpoints, but not the routing and transformation of messages from endpoint to endpoint.
That said, it USED to have an ESB bundled with it. It used to ship with OpenESB in GF 2.x, but that's been removed from GF 3.x.
Glassfish is an application server. You could certainly run an ESB on top of it, but there are several features missing out-of-the-box from what is typically considered an ESB. You're kind of comparing apples to oranges here -- an app-server provides the structure that supports a web application, whereas the primary goal of an ESB is to help distribute information to/from potentially several applications.

Containerless deployment of JAX-RS Restful Service In Java

JAX-RS is a specification that helps you develop restful web services in Java.
But JAX-RS seem to be requiring a servlet container like "Tomcat"or "Jetty".
Managing container in a clustered mode is painful and more operations heavy.
Is there way to start JAX-RS service like a normal Java program/application ?
I want to use JAX-RS implementation but I don't want to follow typical"deploy" cycle.
JAX-RS is strongly linked to HTTP, hence most implementations (eg Jersey, Apache CXF) run in a servlet, which in turn runs in a container such as Tomcat or Jetty. I guess you could develop your own standalone JAX-RS implementation, but you'd end up reinventing the wheel as you'd be forced to implement most aspects of a web server.
Your worries about clustering also seem unfounded. Clustering Tomcat is simple, it is a very common thing to do and there's plenty of information available on the subject. It seems like clustering a custom implementation would actually be a much harder job.

OSGI creating modular web application

I have been looking for a solution to create a modular web application, which is modular in the sense that user can provide its own plugin in form of a simple jar which will then provide its own data to my web application and my webapp will be responsible for displaying it.
Now the catch is i want my web app to be as generic as possible without relying on the j2ee web container to support anything . i.e. i cant rely on my web container to provide osgi support and deploy web application as an osgi bundle itself ( which truly makes things very simple for eg. glassfish and WAS).
I am planning to use equinox and only solution i see currently is the servlet bridge they provide on their official site, but to me it is really a pain to delegate everything to a servlet which will in turn interpret the request and find an apropriate bundle Class and then again communicate back somehow only the data to the web application.
To me it would be wonderful if my web app was also a bundle.
Is there anything close to this ideal solution which i can try for? Or any other communication method between the two relams of osgi and web appliction (container)?
The OSGi spec details the WAB (Web Archive Bundle) format.
And Pax Web offers great support for WAB/WAR webapps (PAX Web runs fine on Equinox, Felix, etc)
Using pax web you get the BundleContext via the ServletContext, eg:
BundleContext bundleContext = (BundleContext) getServletContext().getAttribute("osgi-bundlecontext");
For the user driven pluggability you mention, I'd suggested you provide some service interfaces for the plugin bundles to implement and in your webapp use a ServiceTracker to listen for their registration (unless you're using Declarative Services). You also easily be able to install bundles from an upload servlet.
I'm guessing users uploading plugins would have to be logged in and authorized, so security issues will have been met at this point.
EDIT: replying to comment here as not enough space in comment field
Apologies, think I misinterpreted you question - you have an existing webapp container(s) and you want to deploy a WAR with OSGi functionality? If that's the case then either use the ServletBridge as others have mentioned or embed an OSGi framework into your WAR (this is relatively easy, see this for example).
You could even make this optional by attempting to get the BundleContext from the ServletContext and if this returns null then launch your own embedded framework. That way it'll run in a native OSGi container (e.g. Glassfish) or in a Java EE app server.
Otherwise, PaxWeb is an implementation of the HttpService and WebApp OSGi specs, but with lots of extensions to make life easier - but you deploy this to an OSGi container.
You might want to look into Apache Sling. It is a web framework that has an embedded OSGi container. The OSGi container is called Apache Felix and is pretty good.
ServletBridge is for embedding an OSGI contianer within a web container. The other option is to embed a web container (as a bundle) in an OSGI container. The following article has some details on how to achieve this.
http://java.dzone.com/articles/osgi-and-embedded-jetty
You may want to try ChonCMS - http://www.choncms.com
Its architecture is based exactly on what you are asking, it comes with few plugins to enable base CMS functionality, it is modular platform with minor web app container using felix and plugins can be added/removed at run time as well.
Disadvantage might be that it has lack of documentation, but you may ask, it is open source, I'm sure they will be happy to answer questions, and even better you can contribute - it is still in incubation phase.

Categories