This section details strategies that Glacier2 clients can use to address more advanced requirements.
On this page:
An application that needs to support callback requests from a router as well as requests from local clients should use multiple object adapters to ensure that proxies created by these object adapters contain the appropriate endpoints. For example, suppose we have the network configuration as shown in the following illustration:
Notice that the two local area networks use the same private network addresses, which is not an unrealistic scenario.
Now, if the callback client were to use a single object adapter for handling both callback requests and local requests, then any proxies created by that object adapter would contain the application's local endpoints as well as the router's server endpoints. As you might imagine, this could cause some subtle problems.
The solution is to dedicate an object adapter solely to handling callback requests, and another one for servicing local clients. The object adapter dedicated to callback requests must be configured with the router proxy.
A client is not limited to using only one router at a time: the proxy method ice_router
allows a client to configure its routed proxies as necessary. With respect to callbacks, a client must create a new callback object adapter for each router that can forward callback requests to the client. A client must also be aware of the object identities in use by the routers.
RouterFinder
InterfaceA router's identity can be changed by setting the Glacier2.InstanceName
property, which affects the category portion of the identity. The default identity of a Glacier2 router is Glacier2/Router
, but we can change it to Production/Router
with the following setting:
Glacier2.InstanceName=Production |
A client could configure its corresponding router proxy as follows:
Ice.Default.Router=Production/Glacier2:tcp -p 4063 -h prodhost |
In most cases the client can statically configure the router's proxy as we've shown here. For clients that need to discover a router's proxy at run time, Ice also requires router implementations to support the RouterFinder
interface:
module Ice { interface RouterFinder { Router* getRouter(); } } |
An object supporting this interface must be available with the identity Ice/RouterFinder
. By knowing the host and port of a router's client endpoints, a client can discover the router's proxy with a call to getRouter
:
|