Proxy endpoints allow RCF clients to connect to RCF servers that they are otherwise unable to connect directly to.
There are a number of situations in which a client may be unable to establish a direct network connection to a server it intends to call.
Proxy endpoints provide a workaround for these situations, allowing one RCF server (the proxy server) to serve as a proxy for another RCF server (the destination server). The proxy server maintains a pool of connections from the destination server, and uses these connections to allow clients to connect through to the destination server.
The proxy server accepts connections from a destination server, and keeps these connections in a connection pool. The connections are then subsequently used for clients wanting to connect to that particular destination server.
Each destination server must present a name to the proxy server. The destination server name is arbitrary and chosen by your application. The clients will use the destination server name to specify which server they want to connect to.
To set up a proxy server, you configure a
RCF::RcfServer as usual, and then call
RCF::RcfServer::setEnableProxyEndpoints(). Once started, the
RcfServer will begin registering destination servers and proxying connections from clients to those destination servers.
At any time, you can query the proxy server, for the names of the proxy endpoints that are currently available:
RcfServer is configured with a
RCF::ProxyEndpoint parameter, specifying the network address of the proxy server, and the name the destination server will be exposed as.
Once started, the destination
RcfServer will begin initiating network connections to the proxy server. These connections will subsequently be used by clients to make remote calls back to the destination server.
Once the destination server and proxy server are up and running, a client can connect to the destination server by using a
RCF::ProxyEndpoint and specifying the network address of the proxy server along with the name of the destination server.
The client can now make remote calls as usual, and is able to disconnect and re-connect, just as it would with an un-proxied connection. Each distinct RCF client will have its own distinct network connection to the destination server, and the lifetime of any session objects created on the destination server, will be mapped to the lifetime of the clients proxied network connection.