ConfigurationA Cassandra based implementation of the Space Data Source. Library dependenciesThe Cassandra Space Data Source uses Cassandra JDBC Driver and Hector Library For communicating with the Cassandra cluster. <!-- currently the cassandra-jdbc library is not the central maven repository --> <repository> <id>org.openspaces</id> <name>OpenSpaces</name> <url>http://maven-repository.openspaces.org</url> </repository> <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-clientutil</artifactId> <version>1.1.6</version> </dependency> <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-thrift</artifactId> <version>1.1.6</version> </dependency> <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-jdbc</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>org.hectorclient</groupId> <artifactId>hector-core</artifactId> <version>1.1-2</version> </dependency> SetupAn example of how the Cassandra Space Data Source can be configured for a space that loads data back from Cassandra once initialized and
Spring
<?xml version="1.0"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:os-core="http://www.openspaces.org/schema/core" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.openspaces.org/schema/core http://www.openspaces.org/schema/9.5/core/openspaces-core.xsd"> <bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> <bean id="cassandraDataSource" class="org.apache.cassandra.cql.jdbc.CassandraDataSource"> <constructor-arg value="${cassandra.host}" /> <constructor-arg value="${cassandra.port}" /> <constructor-arg value="${cassandra.keyspace}" /> <constructor-arg value="${cassandra.user}" /> <constructor-arg value="${cassandra.password}" /> <constructor-arg value="2.0.0" /> </bean> <bean id="hectorClient" class="org.openspaces.persistency.cassandra.HectorCassandraClientFactoryBean"> <!-- comma separated seed list --> <property name="hosts" value="${cassandra.host}" /> <!-- cassandra rpc communication port --> <property name="port" value="${cassandra.port}" /> <!-- keyspace name to work with --> <property name="keyspaceName" value="${cassandra.keyspace}" /> </bean> <bean id="cassandraSpaceDataSource" class="org.openspaces.persistency.cassandra.CassandraSpaceDataSourceFactoryBean"> <!-- configured above --> <property name="cassandraDataSource" ref="cassandraDataSource" /> <!-- configured above --> <property name="hectorClient" ref="hectorClient" /> </bean> <os-core:space id="space" url="/./dataSourceSpace" space-data-source="cassandraSpaceDataSource" schema="persistent" mirror="true"> <os-core:properties> <props> <!-- Use ALL IN CACHE, put 0 for LRU --> <prop key="space-config.engine.cache_policy">1</prop> <prop key="cluster-config.cache-loader.central-data-source">true</prop> <prop key="cluster-config.mirror-service.supports-partial-update">true</prop> </props> </os-core:properties> </os-core:space> <os-core:giga-space id="gigaSpace" space="space" /> </beans> Code HectorCassandraClient hectorClient = new HectorCassandraClientConfigurer() .clusterName(cluster) .hosts(cassandraHosts) .port(cassandraPort) .keyspaceName(cassandraKeyspaceName) .create(); CassandraDataSource ds = new CassandraDataSource( cassandraHosts, cassandraPort, cassandraKeyspaceName, cassandraUser, cassandraPassword, "2.0.0"); CassandraSpaceDataSource spaceDataSource = new CassandraSpaceDataSourceConfigurer() .cassandraDataSource(ds) .hectorClient(hectorClient) .create(); GigaSpace gigaSpace = new GigaSpaceConfigurer(new UrlSpaceConfigurer("/./space") .schema("persistent") .mirror(true) .cachePolicy(new LruCachePolicy()) .addProperty("cluster-config.cache-loader.central-data-source", "true") .addProperty("cluster-config.mirror-service.supports-partial-update", "true") .spaceDataSource(spaceDataSource) .space()).gigaSpace(); For more details about different configurations see Space Persistency. CassandraSpaceDataSource Properties
ConsiderationsGeneral limitations
Cache miss Query limitationsSupported queries:
Unsupported queries:
Unsupported queries and queries on unindexed properties will result in a runtime exception. |
![]() |
GigaSpaces.com - Legal Notice - 3rd Party Licenses - Site Map - API Docs - Forum - Downloads - Blog - White Papers - Contact Tech Writing - Gen. by Atlassian Confluence |