IceLocatorDiscovery

4 min read

4 min read

4 min read

3 min read

3 min read

3 min read

3 min read

3 min read

3 min read

IceLocatorDiscovery is an Ice plug-in that discovers a locator on the local network with UDP multicast. An application that installs it resolves its indirect proxies through the discovered locator, without setting Ice.Default.Locator.

IceGrid registries answer the plug-in's queries, so an application can use the plug-in to find an IceGrid deployment, including a replicated deployment.

IceLocatorDiscovery relies on a location service, such as IceGrid, that runs on your network. The IceDiscovery plug-in provides a location service with no additional process to run.

Install the plug-in in each communicator that discovers its default locator.

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.

The IceGrid node that starts a server configures its locator: the node sets Ice.Default.Locator or, when the node itself uses IceLocatorDiscovery, installs the plug-in in the server. Do not install the plug-in in the descriptor of a deployed server.

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.

IceGrid registries answer multicast discovery queries unless you set IceGrid.Registry.Discovery.Enabled to 0, and IceGrid.Registry.Discovery.Interface restricts a registry to one network interface.

The command-line and graphical IceGrid administrative tools discover the registries on the network and let you choose one. They read IceLocatorDiscovery.Address, IceLocatorDiscovery.Port and IceLocatorDiscovery.Interface for their multicast settings.

You can also use the plug-in inside an IceGrid deployment, to simplify the configuration of its nodes and slave registries: a node discovers its registry, and a slave registry discovers the master registry, without Ice.Default.Locator. Install the plug-in in the configuration file of the node or slave registry, and set IceLocatorDiscovery.InstanceName to the instance name of the deployment:

Properties
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscovery
IceLocatorDiscovery.InstanceName=IceGrid