Sunday, November 18, 2012

Getting a glimpse of the Webmethods Integration Server OSGi-container.

After having followed an excellent presentation @Devoxx (Modular Architecture Today by Kirk Knoernschild), I decided to dive a bit into the OSGi container of SoftwareAG's Integration Server.

As documentation on this is scarce, the following information is not official and just bits and pieces I picked up, or investigated myself. The OSGi container was introduced in version 8.2.2, to cope with new components such as the Event server.
What SAG decided to do with the OSGi runtime, was to run the IS as one bundle and other components (such as the event server or common components) as other bundles. As runtime they choose the equinox implementation from Eclipse. This implementation comes with an easy to use console which can show us all the (active/loaded) bundles. This will be the goal of this article to get the console running and show us the bundles SAG is loading.

We're in luck: all we need to do is add "-console [port]" to the start-up of the OSGi-container. If you think you can find it in server.bat, you're half way there...this file now points to the OSGi-container, which you can find under [your_install_dir]\profiles\IS. We are interested in the start-up, so we will open "bin\runtime.bat". There you will find:

%JAVA_RUN% -Xbootclasspath/a:"%OSGI_CLASSPATH%" %JAVA_OPTS% %JAVA_SYSPROPS% -cp "%OSGI_FRAMEWORK_JAR%" org.eclipse.equinox.launcher.Main -configuration %OSGI_CONFIGURATION_AREA% %CMD_ARGS%

Just change it to:

%JAVA_RUN% -Xbootclasspath/a:"%OSGI_CLASSPATH%" %JAVA_OPTS% %JAVA_SYSPROPS% -cp "%OSGI_FRAMEWORK_JAR%" org.eclipse.equinox.launcher.Main -configuration %OSGI_CONFIGURATION_AREA% %CMD_ARGS% -console [port]

with [port], the port which you want to use to access the console.

Now just launch the server.bat. In your prompt, you should see something like: "Listening on port [port] ...". So lets now connect to the console, just open a telnet session to the port and your there:

telnet localhost [port]

Next type "ss" and you should get a list of all the bundles that are loaded:
Some useful commands are listed below:

start
Starts a bundle given an ID or symbolic name
stop
Stops a bundle given an ID or symbolic name
install
Adds a bundle given a URL for the current instance
uninstall
Removes a bundle given a URL for the current instance
update
Updates a bundle given a URL for the current instance
active
Lists all active bundles in the current instance
headers
List the headers for a bundle given an ID or symbolic name
ss
Lists a short status of all the bundles registered in the current instance
services <filter>
Lists services given the proper filter
diag
Runs diagnostics on a bundle given an ID or symbolic name


Hopefully this could prove helpful, especially when SAG extends its use of OSGi.

Author: Stefan

No comments:

Post a Comment