Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 2.62 KB

README.md

File metadata and controls

78 lines (54 loc) · 2.62 KB

Embedded Cassandra

Github CI codecov Maven Central Javadoc

Getting Started

Embedded Cassandra provides an easy way to start and stop Apache Cassandra.

To learn more about Embedded Cassandra, please consult the reference documentation.

All versions of Embedded Cassandra reference documentation are here.

Here is a quick teaser of starting Cassandra:

<dependecies>
    <dependency>
        <groupId>com.github.nosan</groupId>
        <artifactId>embedded-cassandra</artifactId>
        <version>5.0.0</version>
    </dependency>
</dependecies>
import java.net.InetSocketAddress;

import com.datastax.oss.driver.api.core.CqlSession;

import com.github.nosan.embedded.cassandra.Cassandra;
import com.github.nosan.embedded.cassandra.CassandraBuilder;
import com.github.nosan.embedded.cassandra.Settings;
import com.github.nosan.embedded.cassandra.cql.CqlScript;

public class CassandraExample {

	public static void main(String[] args) {
		Cassandra cassandra = new CassandraBuilder().build();
		cassandra.start();
		try {
			Settings settings = cassandra.getSettings();
			try (CqlSession session = CqlSession.builder()
					.addContactPoint(new InetSocketAddress(settings.getAddress(), settings.getPort()))
					.withLocalDatacenter("datacenter1")
					.build()) {
				CqlScript.ofClassPath("schema.cql").forEachStatement(session::execute);
			}
		}
		finally {
			cassandra.stop();
		}
	}

}

Issues

Embedded Cassandra uses GitHub's issue tracking system to report bugs and feature requests. If you want to raise an issue, please follow this link

Also see CONTRIBUTING.md if you wish to submit pull requests.

Build

Embedded Cassandra can be easily built with the maven wrapper. You also need JDK 11.

License

Embedded Cassandra is released under the Apache License 2.0