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 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.

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:

C++
#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:

Properties
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery

When 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:

C#
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:

Properties
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:IceLocatorDiscovery.PluginFactory

When you write a client, you should install IceLocatorDiscovery in your communicator using the pluginFactories field of InitializationData:

Java
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:

Properties
Ice.Plugin.IceLocatorDiscovery=com.zeroc.IceLocatorDiscovery.PluginFactory

This mapping includes the IceLocatorDiscovery factory. Enable it with:

Properties
Ice.Plugin.IceLocatorDiscovery=1

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.

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:

For example, to use a different multicast address and port:

Properties
IceLocatorDiscovery.Address=239.255.0.99
IceLocatorDiscovery.Port=8000

See IceLocatorDiscovery Properties for the complete list.

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.

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:

Properties
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery

The 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:

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]

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:

Properties
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery