Search code examples
scalacassandraphantom-dslphantom-types

ContactPoints vs ContactPoint in Phantom-DSL


Why Phantom-DSL have ContactPoints and ContactPoint two different ways for Connectors?

While using ContactPoint I can omit using host or can have host as String but I have to declare port in here.

val default: CassandraConnection = ContactPoint(port).keySpace(keyspace)

But while using ContactPoints for connection I have to declare host as Seq[String] and can have or omit port here.

val default: CassandraConnection = ContactPoints(host).keySpace(keyspace)

Is there any other difference than what I am thinking?


Solution

  • The usage really depends on the underlying Cassandra cluster. If you have let's say a single instance of Cassandra then ContactPoint will suffice. However, a more realistic case is when you have a 3-Node Cassandra cluster in which case you might want to declare the contact points for every single instance separately through ContactPoints.