How do I connect a client to TypeDB Cluster instead of regular TypeDB?

I’m in the process of upgrading some applications that connect to TypeDB using the Java client API, to work with TypeDB Cluster. What are the differences between connecting to Cluster and connecting to regular TypeDB? Are there any additional steps that we need to take?

The TypeDB Client API is very consistent between a Core (regular) and Cluster TypeDB connection:

  • Opening sessions, transactions and running queries are identical
  • Exploring answers using the Concept API is also identical

The only required change is how you instantiate the Client. In your code, instead of writing:

final TypeDBClient client = TypeDB.coreClient(address);

Use the clusterClient method instead:

final TypeDBClient.Cluster client = TypeDB.clusterClient(addresses);

where addresses is a list of the server addresses.