IceLocatorDiscovery
5 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
4 min read
IceLocatorDiscovery Overview
IceLocatorDiscovery discovers an IceGrid locator (registry) using UDP multicast. It installs a locator in the communicator. This locator discovers the IceGrid registry when the application first resolves an indirect proxy, and forwards locator requests to it.
This lets clients locate an IceGrid deployment without configuring its registry endpoints, including a replicated deployment. IceLocatorDiscovery discovers locators; IceDiscovery provides a location service for objects and object adapters directly.
Installing IceLocatorDiscovery
Install the plug-in in each communicator that should discover its locator. IceGrid nodes and slave registries can also use the plug-in to discover the registry.
When you write a client, you should install IceLocatorDiscovery in your communicator using the pluginFactories field of InitializationData:
#include <IceLocatorDiscovery/IceLocatorDiscovery.h>
Ice::InitializationData initData;initData.properties = Ice::createProperties(argc, argv);initData.pluginFactories = {IceLocatorDiscovery::locatorDiscoveryPluginFactory()};
Ice::CommunicatorPtr communicator = Ice::initialize(initData);Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscoveryWhen you use pluginFactories, link your application with the IceLocatorDiscovery library.
When you write a client, you should install IceLocatorDiscovery in your communicator using the pluginFactories field of InitializationData:
var initData = new Ice.InitializationData{ properties = new Ice.Properties(ref args), pluginFactories = [new IceLocatorDiscovery.PluginFactory()]};
await using Ice.Communicator communicator = Ice.Util.initialize(initData);Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:IceLocatorDiscovery.PluginFactoryWhen you write a client, you should install IceLocatorDiscovery in your communicator using the pluginFactories field of InitializationData:
InitializationData initData = new InitializationData();initData.properties = new com.zeroc.Ice.Properties(args);initData.pluginFactories = java.util.List.of(new com.zeroc.IceLocatorDiscovery.PluginFactory());
try (Communicator communicator = new Communicator(initData)) { // Use the communicator.}Alternatively, you can install the IceLocatorDiscovery plug-in at runtime using configuration:
Ice.Plugin.IceLocatorDiscovery=com.zeroc.IceLocatorDiscovery.PluginFactoryThis mapping includes the IceLocatorDiscovery factory. Enable it with:
Ice.Plugin.IceLocatorDiscovery=1Configuring IceLocatorDiscovery
Applications configure IceLocatorDiscovery with properties. Do not set Ice.Default.Locator in an application that installs the plug-in.
A server deployed with IceGrid does not need to install the plug-in: the IceGrid node that starts this server provides its locator configuration.
IceLocatorDiscovery Property Overview
The plug-in and the IceGrid registry have the same default multicast address and port, so the plug-in works without any configuration when the registry keeps these defaults.
The main properties are:
- IceLocatorDiscovery.InstanceName selects the IceGrid deployment with this instance name. When this property is unset, the plug-in keeps the instance name of the first locator it discovers.
- IceLocatorDiscovery.Address and IceLocatorDiscovery.Port set the multicast address and port of the queries. They must match the registry's IceGrid.Registry.Discovery.Address and IceGrid.Registry.Discovery.Port.
- IceLocatorDiscovery.Interface restricts the queries to one network interface. By default, the plug-in sends its queries on all interfaces.
For example, to use a different multicast address and port:
IceLocatorDiscovery.Address=239.255.0.99IceLocatorDiscovery.Port=8000See IceLocatorDiscovery Properties for the complete list.
Configuring IceLocatorDiscovery in IceGrid Administrative Clients
Support for multicast discovery is built into the command-line and graphical IceGrid administrative utilities, therefore you don't need to install the plug-in. Both utilities read the same IceLocatorDiscovery.* properties as the plug-in, for example to change the multicast address and port.
Configuring IceLocatorDiscovery in an IceGrid Registry
A slave registry can use the plug-in to find the master registry, in place of setting Ice.Default.Locator. Load the plug-in in the slave registry's configuration file:
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscoveryThe master registry does not need the plug-in.
IceGrid registries listen for multicast discovery queries by default, but you can disable this feature by setting IceGrid.Registry.Discovery.Enabled to 0.
If you've changed the default multicast address or port for IceLocatorDiscovery, you must also make corresponding changes to the configuration of each registry. The registry supports properties similar to those of IceLocatorDiscovery:
- IceGrid.Registry.Discovery.Address
- IceGrid.Registry.Discovery.Port
- IceGrid.Registry.Discovery.Interface
These properties influence the endpoint on which the registry listens for multicast discovery queries. If you don't override the endpoint by setting IceGrid.Registry.Discovery.Endpoints, the registry uses these properties to compute its endpoint as follows:
IceGrid.Registry.Discovery.Endpoints=udp -h address -p port [--interface interface]
Configuring IceLocatorDiscovery in an IceGrid Node
An IceGrid node can use the plug-in to find its registries, in place of setting Ice.Default.Locator. Load the plug-in in the node's configuration file:
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery