Skip to content
Kirill edited this page Dec 30, 2021 · 17 revisions

This part of the documentation covers all the pivotal technologies on which is build the OAP.

1. The IoC Container

The chapter covers OAP’s Inversion of Control (IoC) container.

1.1 Service declaration

An OAP IoC container manages one or more services. To declare service the oap-module config is used, it can be .yaml or .conf format. Let's see how to declare a simple service.

Create the next java class:

package io.xenoss.examples;

public class DBService {

   private String dbUrl;
   private String username;
   private String password;

   public DBService(String dbUrl, String username, String password) {
       this.dbUrl = dbUrl;
       this.username = username;
       this.password = password;
   }

  ...

}

Then we need to create oap-module config with the definition of the service above:

For oap-module.yaml

name: repositories

services:
  dbService:
    implementation: io.xenoss.examples.DBService
    name: db_service
    parameters:
      dbUrl: jdbc:mysql://localhost:3306/testDb 
      username: admin
      password: admin123

For oap-module.conf

name = repositories

services {
  dbService {
    implementation = io.xenoss.examples.DBService
    name = db_service
    parameters {
      dbUrl = jdbc:mysql://localhost:3306/testDb 
      username = admin
      password = admin123
  }
}

The above service definition has two mandatory attributes implementation and parameters. The parameters are the named parameters from the constructor and order is not important. Whereas the name attribute is optional and is used to refer to this service as a dependency in the other services (more details in the next section).

1.2 Dependencies and modules

1.3 Service lifecycle

1.4 Listeners

1.5 Remote services

1.6 Extentions