Apache Felix – Register OSGi Service

Yesterday we built two OSGi bundles using Maven.

 

And we have installed the Apache Felix

 

So now, we are going to install the OSGi bundles on Apache Felix.

1. Start the Apache Felix.

  • java -jar bin\felix.jar


 

2. Install the OSGi bundles using the install command.

 

3. The bundles are installed but the services are not yet started. So the state of the newly installed bundles are Installed. To start the OSGi service, use the start <ID> command.

 

4. Now the Service listener example is registered. This service will echo a message whenever a new service is registered or unregistered. Let’s try it by starting and stopping the English dictionary service.

 

5. As you can see, we got 2 messages when we start and stop the English dictionary service.

  • Ex1: Service of type tutorial.example2.service.DictionaryService registered.
  • Ex1: Service of type tutorial.example2.service.DictionaryService unregistered.

The above two OSGi bundles are based on the first two tutorials at Apache Felix Website. I will try the rest of the tutorials later.

Done =)

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s