Was hopping to get a full example with authentication, etc on how to use Spring-data-cassandra.
So far, I have been learning from reading the source code.
I saw that another user here has asked a few questions regarding writing a REST application with Cassandra.
I can write the REST app, the service and repository. But I would like to understand a few things.
Well, I am using Cassandra 2.x and 1.1.0.BUILD-SNAPSHOT of Spring-data-Cassandra.
I would like to understand it better.
1) How to write a spring repository to use Spring-data-cassandra?
2) How to initialize it so that I can pass all the machines on the cluster?
3) I have done a connection pool before with Thrift. Wrote the code for it. Does Spring-data-Cassandra provide a connection pool? If it does, how to configure that?
I see that AbstractSessionConfiguration extends AbstractClusterConfiguration. The AbstractClusterConfiguration defines a bean called cluster ( CassandraCqlClusterFactoryBean cluster()) which returns a bunch of things on the cluster.
To configure a Session I can extend AbstractSessionConfiguration. I see that CassandraCqlClusterFactoryBean has pooling options as well. Interesting that if I create my Cassandra java config from AbstractCassandraConfiguration, it extends AbstractClusterConfiguration which has a bean CassandraCqlClusterFactoryBean.
The AbstractCassandraConfiguration gives me CassandraSessionFactoryBean for Session information, getAuthProvider method that returns the AuthProvider object (so I can do authentication). The getAuthProvider actually comes from AbstractClusterConfiguration which is what AbstrsctCassandraConfiguration extends.
So I guess the basic thing is to setup a CassandraCqlClusterFactoryBean so you can set a bunch of things:
- setContactPoints so I can pass a list of nodes separated by a comma.
- setAuthProvider so I can set the credentials but there is also setUsername and setPassword. Interesting.
So I would like to also understand the CassandraCqlClusterFactoryBean.
An example would be great on using Spring-Data-Cassandra with Cassandra 2.x so I can have my REST API to use it through a repository.
Thanks,
Carlos.
PS: Sorry for typos, being studying source code for long hours.