The Remote Service Admin Service subproject contains an adapted implementation of the OSGi Enterprise Remote Service Admin Service Specification. The subproject consists of three parts, each described in more detail in the following sections.
The topology manager decides which services should be imported and exported according to a defined policy. Currently, only one policy is implemented in Celix, the promiscuous policy, which simply imports and exports all services.
Bundle | Celix::rsa_topology_manager |
---|---|
Configuration | None |
The Remote Service Admin (RSA) provides the mechanisms to import and export services when instructed to do so by the Topology Manager.
Provides remote service admin using HTTP and JSON. The serialization is done using libdfi to convert function call information into JSON representation. libffi
is configured using descriptor files in the bundles.
Bundle | Celix::rsa_dfi |
---|---|
Configuration | See Remote Service Admin DFI |
Provides remote service admin using shared memory. The serialization implementation is pluggable, and the default serialization is done using libdfi to convert function call information into JSON representation. libffi
is configured using descriptor files in the bundles.
Bundle | Celix::rsa_shm |
---|---|
Configuration | See Remote Service Admin SHM |
Actively discovers the presence of remote exported services and provides information about local exported services, as given by the Topology Manager, to others.
Provides a service discovery with preconfigured discovery endpoints, allowing a static mesh of nodes for remote service invocation to be created. The configured discovery bundle in Celix is compatible with the configured discovery implementation provided by Amdatu Remote.
Bundle | Celix::rsa_discovery |
---|---|
Configuration | DISCOVERY_CFG_POLL_ENDPOINTS : defines a comma-separated list of discovery endpoints that should be used to query for remote services. Defaults to http://localhost:9999/org.apache.celix.discovery.configured ; |
DISCOVERY_CFG_POLL_INTERVAL : defines the interval (in seconds) in which the discovery endpoints should be polled. Defaults to 10 seconds. | |
DISCOVERY_CFG_POLL_TIMEOUT : defines the maximum time (in seconds) a request of the discovery endpoint poller may take. Defaults to 10 seconds. | |
DISCOVERY_CFG_SERVER_PORT : defines the port on which the HTTP server should listen for incoming requests from other configured discovery endpoints. Defaults to port 9999 ; | |
DISCOVERY_CFG_SERVER_PATH : defines the path on which the HTTP server should accept requests from other configured discovery endpoints. Defaults to /org.apache.celix.discovery.configured . |
Note that for configured discovery, the “Endpoint Description Extender” XML format defined in the OSGi Remote Service Admin specification (section 122.8 of OSGi Enterprise 5.0.0) is used.
Provides a service discovery using etcd distributed key/value store.
Bundle | Celix::rsa_discovery_etcd |
---|---|
Configuration | See etcd discovery |
Provides a service discovery using Bonjour.
Bundle | Celix::rsa_discovery_zeroconf |
---|---|
Configuration | See Zeroconf Discovery |
In order to make remote services work without configuring the IP of the RSA, we have designed the following dynamic IP mechanism.
The sequence diagram of the dynamic IP mechanism is as follows:
The example of dynamic IP mechanism see remote-services-zeroconf-server
and remote-services-zeroconf-client
.
To develop for the Remote Service Admin implementation of Celix, one needs the following:
The Celix source repository provides a simple calculator example that shows all of the described parts:
service.exported.interfaces
service property to its service registration. This way, the RSA implementation can expose it as remote service to others;If you have access to the Celix source repository, you can run the calculator example using various discovery implementations by invoking the deploy
target. You can find the example deployments in the CELIX_BUILD/deploy
directory. For example, to run the calculator example using the configured discovery mechanism, you should open two terminals. In the first terminal, type:
remote-service-cfg$ export RSA_PORT=18888 remote-service-cfg$ sh run.sh ... RSA: Export services (org.apache.celix.calc.api.Calculator) ... -> _
In the second terminal, type:
remote-service-cfg-client$ export RSA_PORT=28888 remote-service-cfg-client$ sh run.sh ... RSA: Import service org.apache.celix.calc.api.Calculator ... -> _
Now, if all went well, the client (second terminal) has three new shell commands, add
, sub
and sqrt
, which you can use to invoke the calculator service:
-> add 3 5 CALCULATOR_SHELL: Add: 3.000000 + 5.000000 = 8.000000 -> _
On the server side (first terminal), you can follow each invocation as well:
CALCULATOR_ENDPOINT: Handle request "add(DD)D" with data "{"m": "add(DD)D", "a": [3.0, 5.0]}" CALCULATOR: Add: 3.000000 + 5.000000 = 8.000000
Note that the RSA_PORT
property needs to be unique for at least the client in order to communicate correctly when running the examples on the same machine.
To build the Remote Service Admin Service the CMake build option “BUILD_REMOTE_SERVICE_ADMIN
” has to be enabled.If you use conan to build it, you should set the conan option celix:build_remote_service_admin
to true.
The Remote Service Admin Service depends on the following subprojects:
[^1]: Although C does not use the term “method”, we use this term to align with the terminology used in the RSA specification.