public interface AddressTranslator
rpc_addressin the node yaml file. In most case, this is the correct address to use by the driver and that is what is used by default. However, sometimes the addresses received through this mechanism will either not be reachable directly by the driver or should not be the preferred address to use to reach the node (for instance, the
rpc_addressset on Cassandra nodes might be a private IP, but some clients may have to use a public IP, or pass by a router to reach that node). This interface allows to deal with such cases, by allowing to translate an address as sent by a Cassandra node to another address to be used by the driver for connection. Please note that the contact points addresses provided while creating the
Clusterinstance are not "translated", only IP address retrieved from or sent by Cassandra nodes to the driver are.
|Modifier and Type||Method and Description|
Initializes this address translator.
Translates a Cassandra
void init(Cluster cluster)
Clusterinstance for which the translator is created.
InetSocketAddress translate(InetSocketAddress address)
rpc_addressto another address if necessary.
address- the address of a node as returned by Cassandra. Note that if the
rpc_addressof a node has been configured to
0.0.0.0server side, then the provided address will be the node
0.0.0.0. Also note that the port for
InetSocketAddresswill always be the one set at Cluster construction time (9042 by default).
address. If the return is
addresswill be used by the driver (it is thus equivalent to returning
Copyright © 2012–2017. All rights reserved.