Apache Ignite Integrations Documentation

The Apache Ignite Integrations Developer Hub

Welcome to the Apache Ignite Integrations developer hub. You'll find comprehensive guides and documentation to help you start working with Apache Ignite Integrations as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Starting Inside an OSGi Container

Setting-Up the Container

To start Apache Ignite inside an OSGi container you must have at least installed the following bundles:

  • ignite-core
  • ignite-osgi
  • javax cache API

When deploying in Apache Karaf, you may take a shortcut by using the Ignite Feature Repository to install the ignite-core feature. See the "Installation on Apache Karaf" section for more information.

Feel free to install additional Ignite modules to expand the platform's functionality, as you would do by adding modules to the classpath in a standard environment.

Implementing the Ignite Bundle Activator

To start Apache Ignite, implement an OSGi Bundle Activator by extending the abstract class org.apache.ignite.osgi.IgniteAbstractOsgiContextActivator:

package org.apache.ignite.osgi.examples;

import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.osgi.IgniteAbstractOsgiContextActivator;
import org.apache.ignite.osgi.classloaders.OsgiClassLoadingStrategyType;

public class MyActivator extends IgniteAbstractOsgiContextActivator {

    /**
     * Configure your Ignite instance as you would normally do, 
     * and return it.
     */
    @Override public IgniteConfiguration igniteConfiguration() {
        IgniteConfiguration config = new IgniteConfiguration();
        config.setGridName("testGrid");
      
        // ...

        return config;
    }

    /**
     * Choose the classloading strategy for Ignite to use.
     */
    @Override public OsgiClassLoadingStrategyType classLoadingStrategy() {
        return OsgiClassLoadingStrategyType.BUNDLE_DELEGATING;
    }
}

We support two different classloading strategies in OSGi:

  • BUNDLE_DELEGATING: Uses the classloader of the bundle containing the Activator as a first preference, falling back to the classloader of ignite-core in second instance.
  • CONTAINER_SWEEP: Same as BUNDLE_DELEGATING, but ultimately enquires all bundles if the class is still not found.

Future OSGi classloading strategies

We may consider adding other classloading strategies in upcoming releases, such as using the Service Locator mechanism to locate bundles which voluntarily want to expose packages to Ignite's marshallers via a file similar to jaxb.index in the JAXB specification.

Reach out to us in the community (users@ignite.apache.org mailing list) if you'd like to see such options in the future.

Make sure to add the Bundle-Activator OSGi Manifest header to your bundle, in order to instruct the OSGi container to call the Activator on bundle start:

Bundle-SymbolicName: test-bundle
Bundle-Activator: org.apache.ignite.osgi.examples.MyActivator
Import-Package: ...
[...]

To generate the bundle, including the Bundle-Activator OSGi header, we recommend adding the maven-bundle-plugin to your Maven build, with the appropriate configuration instructions:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>${maven.bundle.plugin.version}</version>
  <configuration>
    <Bundle-SymbolicName>...</Bundle-SymbolicName>
    <Bundle-Activator>org.apache.ignite.osgi.examples.MyActivator</Bundle-Activator>
    [...]
  </configuration>
</plugin>