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.
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:
<!-- 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>
<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>
<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>
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=trueIn 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=10Trentino 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.
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: