Trentino Service Discovery

The goal of service discovery is to locate the appropriate services for a reference, if the reference hasn't define its target service explicitly by using one of the methods mentioned under SCA specification, section 4.3.1. Currently service discovery applies to remote services. By using service discovery a component can locate referenced services that are hosted on other Trentino runtimes in the same network. Remote service discovery identifies the matching service and its connection specific information to make remote communication possible. Service discovery is restricted to a local area network.

Reference and Service Wiring with Service Discovery

For remote references (@remotable/interface.cpp/reference = true) service discovery is triggered if no connection specifier attribute is defined for the bindings of the reference.(i.e. for binding.sca service discovery is triggered if uri attribute is not specified) (see Item-2 under SCA specification section 4.3.1) Service discovery matches the services that qualify the following conditions:

  • Services should have the same fully qualified interface class name(@class/interface.cpp).
  • Services should support at least one of the bindings supported by the reference.
  • Services should support the metadata specified by the reference.
In addition to SCA assembly schema version 1.1. Trentino defines an sca:Metadata element which is part of sca:Contract element to be able to describe extra characteristics of services and references. The following snippet shows the pseudo-schema of a reference and a service that hosts metadata.

<!-- metadata schema snippet -->
<composite ... >
...
  <service ... >
   <metadata>
     <stringAttributes name="xs:string" value="xs:string"/>
   </metadata>
   <interface ... />
    <binding uri="xs:anyURI"? name="xs:NCName"? requires="list of xs:QName"?policySets="listof xs:QName"?>
     <wireFormat/>
     <operationSelector/>
     <requires/>
     <policySetAttachment/>
    </binding>
    <callback>
     <binding uri="xs:anyURI"? name="xs:NCName"? requires="list of xs:QName"? policySets="list of xs:QName"?>
      <wireFormat/>
      <operationSelector/>
      <requires/>
      <policySetAttachment/>
     </binding>
    </callback>
  </service>
  <reference ... >
   <metadata>
     <stringAttributes name="xs:string" value="xs:string"/>
   </metadata>
   <interface ... />
    <binding uri="xs:anyURI"? name="xs:NCName"? requires="list of xs:QName"?policySets="listof xs:QName"?>
     <wireFormat/>
     <operationSelector/>
     <requires/>
     <policySetAttachment/>
    </binding>
    <callback>
     <binding uri="xs:anyURI"? name="xs:NCName"? requires="list of xs:QName"? policySets="list of xs:QName"?>
      <wireFormat/>
      <operationSelector/>
      <requires/>
      <policySetAttachment/>
     </binding>
    </callback>
  </reference>
</composite>

 
Example: The following SCDL is an example of a reference that will be wired via service discovery.

		<reference name="BasicPrinterRef">
			<metadata>
				<stringAttributes name="colour" value="yellow"/>
			</metadata>
			<interface.cpp class="Trentino::Example::BasicPrinter" header="services/TrentinoExampleBasicPrinter.h" remotable="true"/>
			<binding.sca/>
		</reference>

 
As the service below supports binding.sca by default, and as it has matching interface and metadata, it is wired to the reference above:

	<service name="BasicPrinter" >
		<metadata>
			<stringAttributes name="floor" value="3"/>
			<stringAttributes name="colour" value="yellow"/>
		</metadata>
        <interface.cpp class="Trentino::Example::BasicPrinter" header="services/TrentinoExampleBasicPrinter.h" remotable="true"/>
    </service>

 
Eventually service discovery provides the binding specific information of the found service. Namely the connection information required for the binding types supported by the found service. (i.e. for binding.sca uri that includes network address, port information of the service is provided ) So runtime can manage the remote communication with this binding communication information. If there are more than one matching services matching, runtime uses one of them randomly.

Enabling and Configuring Service Discovery

Service Discovery Configuration in Runtime.conf

Service discovery is enabled or partially configured in the Runtime.conf file. Trentino uses OpenSLP for service discovery please also refer at the OpenSLP configuration mentioned under the respective section below. The user can enable or disable service discovery for a Trentino runtime. In the Trentino configuration file Runtime.conf, the following options should be available.

[Service_Discovery] # Default to true #default to true enable.remote.service.discovery=true

In case of a discovery failure, the service state should be NOT_AVAILABLE. The runtime MUST be configured to try discovery a number of time if discovery fails. The time interval and the number of retries are configurable in Runtime.conf.

[Service_Discovery] #default to false discovery.max.retry=3 #values in seconds discovery.retry.interval=10

OpenSLP and its configuration

Trentino uses OpenSLP for service discovery. http://www.openslp.org/ Service Location Protocol (SLP) is an Internet Engineering Task Force (IETF) standards track protocol that provides a framework to allow networking applications to discover the existence, location, and configuration of networked services in enterprise networks. The OpenSLP project is an effort to develop an open-source implementation of the IETF Service Location Protocol suitable for commercial and non-commercial application. Errors that are detected at network by OpenSLP are logged or notified with error codes of OpenSLP. For the meanings of error codes please see Appendix-B.

OpenSLP configuration file

slp.conf is the configuration used by OpenSLP. Some of these parameters hame more vital importance based on the network conditions. Default version of this configuration file is comes with Trentino installation. For a local area network that has Trentino runtimes operating, to have service discovery function available, at least one of Trentino runtimes must play the role of directory agent (SLP terminology, for further information please check out OpenSLP documentation or SLP RFC-2608). So for each LAN the user needs to set net.slp.isDA to true for at least one Trentino runtime, to have service discovery feature work. User might be potentially be interested in the following attributes:

  • net.slp.isDA: Enables slpd to function as a DA. Only a very few DAs should exist. In Trentino it is true.
  • slp.watchRegistrationPID: If net.slp.watchRegistrationPID is set to true, local registrations made with the SA via the SLPReg() API call will be monitored. If the PID of the process (and/or thread on Linux) disappears (the registering process died unexpectedly with out calling SLPDereg()), then the registration is automatically de-registered. (Default is is false in Trentino)
  • net.slp.unicastMaximumWait: An integer giving the maximum amount of time (in milliseconds) to perform unicast requests.(Default is is 50000 ms or 50 secs in Trentino)
  • net.slp.multicastMaximumWait: An integer giving the maximum amount of time (in milliseconds) to perform multicast requests (Default is 50000 ms or 50 secs, in Trentino).
The user might need to change other configuration parameters based on the specific needs of networks and in such a case user should refer at the descriptions of configuration parameters in the config file or at the web site of openSLP. http://www.openslp.org/