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 Overview
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.
Installing IceLocatorDiscovery
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:
#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.
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.
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.
IceGrid Registries and Administrative Tools
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.
IceGrid Nodes and Slave Registries
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:
Ice.Plugin.IceLocatorDiscovery=IceLocatorDiscovery:createIceLocatorDiscoveryIceLocatorDiscovery.InstanceName=IceGrid