public interface AddressTranslator extends AutoCloseable
The driver auto-detects new Cassandra nodes added to the cluster through server side pushed
notifications and system table queries. For each node, the address the driver will receive will
correspond to the address set as
broadcast_rpc_address in the node's YAML file. In most
cases, 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
broadcast_rpc_address set on Cassandra nodes might be a private IP, but
some clients may have to use a public IP, or go through a router to reach that node). This
interface addresses such cases, by allowing to translate an address as sent by a Cassandra node
into another address to be used by the driver for connection.
The contact point addresses provided at driver initialization are considered translated already; in other words, they will be used as-is, without being processed by this component.
|Modifier and Type||Method and Description|
Called when the cluster that this translator is associated with closes.
Translates an address reported by a Cassandra node into the address that the driver will use to connect.
@NonNull InetSocketAddress translate(@NonNull InetSocketAddress address)
Copyright © 2017–2022. All rights reserved.