This repository was archived by the owner on May 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
ClusterInformation examples spring
Otávio Santana edited this page Mar 31, 2014
·
3 revisions
<beans>
<bean id = "clusterInformation" class="org.easycassandra.persistence.cassandra.ClusterInformation">
<property name="keySpace" value="campus" />
<property name="hosts">
<list>
<value>localhost</value>
</list>
</property>
</bean>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
<beans>
<bean id = "clusterInformation" class="org.easycassandra.persistence.cassandra.ClusterInformation">
<property name="keySpace" value="campus" />
<property name="user" value="user" />
<property name="password" value="password" />
<property name="hosts">
<list>
<value>localhost</value>
</list>
</property>
</bean>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
<beans>
<bean id = "clusterInformation" class="org.easycassandra.persistence.cassandra.ClusterInformation">
<property name="keySpace" value="campus" />
<property name="replicaStrategy" value="CUSTOM_STRATEGY" />
<property name="customQuery" value="myquery" />
<property name="hosts">
<list>
<value>localhost</value>
</list>
</property>
</bean>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
<beans>
<bean id = "clusterInformation" class="org.easycassandra.persistence.cassandra.ClusterInformation">
<property name="keySpace" value="campus" />
<property name="replicaStrategy" value="SIMPLES_TRATEGY" />
<property name="replicaFactor" value="3" />
<property name="hosts">
<list>
<value>localhost</value>
</list>
</property>
</bean>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
Will Create keyspace with a query:
CREATE KEYSPACE IF NOT EXISTS javabahia WITH replication = {'class': 'SimpleStrategy' , 'replication_factor': 3};
if not exist create a keyspace with a NetworkTopologyStrategy with DC1 with replica factor 2 and DC2 replica factor 3.
<beans>
<bean id = "clusterInformation" class="org.easycassandra.persistence.cassandra.ClusterInformation">
<property name="keySpace" value="campus" />
<property name="replicaStrategy" value="NETWORK_TOPOLOGY_STRATEGY" />
<property name="dataCenter">
<map>
<entry key="DC1" value="2" />
<entry key="DC2" value="3" />
</map>
</property>
<property name="hosts">
<list>
<value>localhost</value>
</list>
</property>
</bean>
<bean id="cassandraFactory" class="org.easycassandra.persistence.cassandra.spring.CassandraFactoryAnnotation">
<constructor-arg name="clusterInformation" ref="clusterInformation" />
<property name="annotatedClasses">
<list>
<value>org.easycassandra.persistence.cassandra.spring.entity.Contact</value>
<value>org.easycassandra.bean.model.Step</value>
<value>org.easycassandra.bean.model.Weight</value>
</list>
</property>
</bean>
</beans>
Will Create keyspace with a query:
CREATE KEYSPACE IF NOT EXISTS javabahia WITH replication = {'class': 'NetworkTopologyStrategy' , 'DC1' : 2,'DC2' : 3 };