OSGi Remote Services allow bundles running on different OSGi frameworks to access services remotely. The Remote Service Admin specification defines how services can be exported and imported across frameworks. Implementations like Amdatu and Apache Celix use HTTP/JSON as the transport and multicast DNS for discovery to enable interoperability between Java and native OSGi frameworks.
2. Agenda
• OSGi
specificaCon
• Remote
Service
Admin
SpecificaCon
• In
a
Java
world...
• ...
and
in
a
NaCve
world
• ImplementaCon
• Amdatu
• Celix
• Interoperability
6. • Endpoint Listener – A listener service that receives updates of Endpoints that match its scope
Endpoint Listener is used symmetrically to implement a federated registry. The Topology
Manager can use it to notify interested parties about created and removed Endpoints, as we
receive notifications from other parties, potentially remote, about their available Endpoint
• Remote Service Admin Listener – A listener service that is informed of all the primitive action
the Remote Service Admin performs like importing and exporting as well as errors.
• Endpoint Configuration Extender – A bundle that can detect configuration data describing an
point Description in a bundle resource, using the extender pattern.
• Discovery – An Endpoint Listener that detects the Endpoint Descriptions through some dis
protocol.
• Cluster – A group of computing systems that closely work together, usually in a fast netwo
Remote
Service
Admin
• Remote
Service
(Admin)
• Enterprise
SpecificaCon
-‐
chapter
100
• Enterprise
SpecificaCon
-‐
chapter
122
Remote Service Admin Entities
Figure 122.1
!
Client impl
discovered by
XML
!
!
!
!
!
Imported &
Exported
Services
Endpoint
Listener
discovers
Topology
Manager Impl
Remote
Service
Admin
Listener
Remote Service
Admin Impl
Discovery Impl
announces
Remote
Service
Admin
Endpoint
Listener
1
0..n
1
0..n to an
Endpoint
discovers/
announces
network/
cluster
configured
Endpoint
7. Remote
Service
Admin
• Topology
Manager
• Detect
exported
/
imported
services
• Detect
service
interests
!
• Remote
Service
Admin
• Export
/
import
services
• Endpoint
creaCon
through
the
use
of
Endpoint
properCes
8. 122.6
Discovery
Discovery
The topology of the distributed system is decided by the Topology Manager. However, in a distrib
uted environment, the Topology Manager needs to discover Endpoints in other frameworks. There
very large number of ways how a Topology Manager could learn about other Endpoints, ranging
from static configuration, a centralized administration, all the way to fully dynamic discovery pro
cols like the Service Location Protocol (SLP) or JGroups. To support the required flexibility, this sp
ification defines an Endpoint Listener service that allows the dissemination of Endpoint informatio
This service provides a symmetric solution because the problem is symmetric: it is used by a Topo
ogy Manager to announce changes in its local topology as well as find out about other Endpoint
Descriptions. Where those other Endpoint Descriptions come from can vary widely. This design i
depicted in Figure 122.5 on page 315.
• Publish
endpoints
• Discover
endpoints
• Scoping
Figure 122.5
Topology Information Dissemination Examples
!
Static
Configuration
Managed
Service Factory
!
!
!
!
Endpoint
Listener
Topology
Manager
Configuration
Extender
extends
Network
Discovery
discovers/
announces
discovers
announces
Endpoint
Listener
Topology
Map
displays
networks
display
9. Remote
Services
«service»
Server
imported = "true"
Server
«service»
Server
remote = "true"
ServerStub
Client
ServerProxy
Registry
«track»
Proxy
Publisher
Remote
Publisher
Stubs
«service»
Discovery
Service
«service»
Discovery
Service
Proxies
10. Use
cases
• Research
Projects
• STARS/INAETICS
• (Re)Configurable
dynamic
systems
• Machine
2
Machine
• Heterogeneous
systems
• Home
automaCon
13. Amdatu/Celix
Remote
Services
• HTTP/JSON
• HTTP
is
well
known
and
supported
in
all
languages
• JSON
is
simple
and
lightweight
• MulCcastDNS
• Supported
on
many
pladorms/languages
• Interoperability
• From
C
to
Java
and
vice
versa
• Todo
• Generate
C
code
for
endpoints
14. Demo
-‐
Calculator
• Calculator
shell
commands
• add
/
sub
/
sqrt
public interface
public double
public double
public double
}
Calculator {
add(double a, double b);
sub(double a, double b);
sqrt(double a);
struct calculator_service {
calculator_pt example;
celix_status_t (*add)(calculator_pt example,
double a, double b, double *result);
celix_status_t (*sub)(calculator_pt example,
double a, double b, double *result);
celix_status_t (*sqrt)(calculator_pt example,
double a, double *result);
};