Class CassandraArchiveOperationHandler
java.lang.Object
org.openspaces.persistency.cassandra.archive.CassandraArchiveOperationHandler
- All Implemented Interfaces:
ArchiveOperationHandler
Known Limitation: 1. The archiver must not write two different entries with the same ID. This
would corrupt the entry in Cassandra. 2. Only Space Documents are supported 3. The archiver is
thread safe 4. The archiver is idempotent as long as there are no two threads that are writing
two different objects with the same space id.
- Since:
- 9.1.1
- Author:
- Dan Kilman
-
Constructor Summary
ConstructorsConstructorDescriptionCassandraArchiveOperationHandler(GigaSpace gigaSpace, String hosts, String keyspace) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidWrites the specified objects to the external storagevoiddestroy()getHosts()getPort()voidsetColumnFamilyNameConverter(ColumnFamilyNameConverter columnFamilyNameConverter) voidsetFlattenedPropertiesFilter(FlattenedPropertiesFilter flattenedPropertiesFilter) voidsetGigaSpace(GigaSpace gigaSpace) voidvoidsetKeyspace(String keyspace) voidvoidsetPropertyValueSerializer(PropertyValueSerializer propertyValueSerializer) voidsetWriteConsistency(CassandraConsistencyLevel writeConsistency) booleanWhat happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving? The external archive container (assuming the exception is not swollen with an exception handler) will retry archiving all objects.
-
Constructor Details
-
CassandraArchiveOperationHandler
-
-
Method Details
-
setGigaSpace
-
setHosts
- Parameters:
hosts- - Comma separated list of Cassandra servers (ipaddresses or hostnames).- See Also:
-
setPort
- Parameters:
port- - Cassandra server ports. Assumes same port for all servers. null means default port is used.- See Also:
-
setKeyspace
- Parameters:
keyspace- - the Cassandra keyspace name to connect to.- See Also:
-
setWriteConsistency
- Parameters:
writeConsistency- - defines the consistency level used when writing to Cassandra. default is null (which is mapped toCassandraConsistencyLevel.QUORUM)- See Also:
-
setPropertyValueSerializer
- See Also:
-
setFlattenedPropertiesFilter
- See Also:
-
setColumnFamilyNameConverter
- See Also:
-
getGigaSpace
-
getPropertyValueSerializer
-
getFlattenedPropertiesFilter
-
getColumnFamilyNameConverter
-
getHosts
-
getPort
-
getKeyspace
-
getWriteConsistency
-
afterPropertiesSet
@PostConstruct public void afterPropertiesSet() -
destroy
@PreDestroy public void destroy() -
archive
Description copied from interface:ArchiveOperationHandlerWrites the specified objects to the external storage- Specified by:
archivein interfaceArchiveOperationHandler- Parameters:
objects- - one or more objects to write. If notArchiveOperationHandler.supportsBatchArchiving()then only one object is passed at a time.- Throws:
SpaceCassandraException- - Problem encountered while archiving to cassandra- See Also:
-
supportsBatchArchiving
public boolean supportsBatchArchiving()Description copied from interface:ArchiveOperationHandlerWhat happens when the archive operation receives a batch of objects to persist and throws an exception in the middle of the archiving? The external archive container (assuming the exception is not swollen with an exception handler) will retry archiving all objects. If the archive operation implementation is atomic (meaning that throwing an exception cancels all writes - all or nothing) then return true. If the archive operation implementation is idempotent (meaning that writing the same objects twice has no visibility on the result) then return true. Otherwise return false, so the archive method is called one object at a time. Even when returning false, there is a possibility of an object being archived twice in case of a process fail-over.- Specified by:
supportsBatchArchivingin interfaceArchiveOperationHandler- Returns:
- true - Since Multiple archiving of the exact same objects is supported (idempotent).
- See Also:
-