Service discovery: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Many Maria GDK services can be set up to provide WCF UDP discovery. This includes, but is not limited to: * Catalog service (IMapCatalogService) * Preparation service (IMaria...") |
No edit summary |
||
Line 54: | Line 54: | ||
<source lang="csharp">sdq.WantedVersion="3.1";</source> | <source lang="csharp">sdq.WantedVersion="3.1";</source> | ||
[[Category:Service setup]] |
Revision as of 09:40, 7 August 2019
Many Maria GDK services can be set up to provide WCF UDP discovery. This includes, but is not limited to:
- Catalog service (IMapCatalogService)
- Preparation service (IMariaMapPreparationService)
- Track service (IMariaTrackService)
- Draw object store service (IDrawObjectService)
- Location/placename search service (ILocationService)
Discovery allows a service client to search for and connect to available service at runtime.
Service setup
Set "DiscoveryEnabled" to true in the settings.json service configuration file. Note that service discovery is disabled by default for all services.
Example:
{
"Version": "1.0",
"GeneralSettings": {
"InstallDir": "...",
"ServicePort": "9008",
"RegisterAs": "http://XXX:[port]",
"LogPath": "%temp%\\Maria2012Log",
"MaxLogFiles": "3",
"MaxLogSize": "10MB"
},
"MapCatalogSettings": {
"DiscoveryEnabled": true
},
"TrackSettings": {
"DiscoveryEnabled": true
}
// ...
}
Discovering services
Use the class ServiceDiscoveryHelper to perform simple service discovery.
ServiceDiscoveryQuery sdq = new ServiceDiscoveryQuery();
sdq.Duration = TimeSpan.FromSeconds(1);
sdq.Interfaces.Add("IMapCatalogService");
sdq.Interfaces.Add("IMapTemplateService");
var discoveryHelper = new ServiceDiscoveryHelper();
var discovered = discoveryHelper.DiscoverServices(
sdq, a=>Console.WriteLine(a.Address.AbsoluteUri+ " ver:"+a.Version));
Version filtering
Set ServiceDiscoveryQuery member WantedVersion to filter the results based on reported version. The version is set based on the assembly version of the service implementation. By specifying only the most significant parts of the version, eg "3.1", all patch versions 3.1.x will be returned.
sdq.WantedVersion="3.1";