Service discovery: Difference between revisions
Jump to navigation
Jump to search
(→) |
(→) |
||
Line 36: | Line 36: | ||
== Discovering services == | == Discovering services == | ||
Use the class [http:// | Use the class [http://codedocs.maria.teleplanglobe.com/release/managed/class_t_p_g_1_1_service_model_1_1_service_discovery_helper.html ServiceDiscoveryHelper] to perform simple service discovery. | ||
<source lang="csharp"> | <source lang="csharp"> | ||
Line 51: | Line 51: | ||
=== Version filtering === | === Version filtering === | ||
Set ServiceDiscoveryQuery member [http:// | Set ServiceDiscoveryQuery member [http://codedocs.maria.teleplanglobe.com/release/managed/class_t_p_g_1_1_service_model_1_1_service_discovery_query.html#a5f5d220ba95f674413c5ba72387a83ea 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. | ||
<source lang="csharp">sdq.WantedVersion="3.1";</source> | <source lang="csharp">sdq.WantedVersion="3.1";</source> | ||
[[Category:Service setup]] | [[Category:Service setup]] |
Latest revision as of 08:55, 5 November 2020
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";