Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Alpakka Cassandra #736

Merged
merged 2 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
ThisBuild / resolvers += "Akka Snapshots".at("https://repo.akka.io/snapshots/")
// TODO Remove this when depending on released versions of Alpakka
ThisBuild / resolvers += Resolver.bintrayRepo("akka", "snapshots")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME that this should be removed


lazy val root = (project in file("."))
.enablePlugins(Common, ScalaUnidocPlugin)
.disablePlugins(SitePlugin)
.aggregate(core, cassandraLauncher, session)
.aggregate(core, cassandraLauncher)
.settings(name := "akka-persistence-cassandra-root", publish / skip := true)

lazy val session = project
.enablePlugins(Common, AutomateHeaderPlugin)
.settings(
name := "akka-cassandra-session",
libraryDependencies ++= Dependencies.akkaCassandraSessionDependencies,
Compile / packageBin / packageOptions += Package.ManifestAttributes(
"Automatic-Module-Name" -> "akka.stream.alpakka.cassandra"))

lazy val dumpSchema = taskKey[Unit]("Dumps cassandra schema for docs")
dumpSchema := (core / runMain in (Test)).toTask(" akka.persistence.cassandra.PrintCreateStatements").value

lazy val core = (project in file("core"))
.enablePlugins(Common, AutomateHeaderPlugin, MultiJvmPlugin)
.dependsOn(cassandraLauncher % Test, session)
.dependsOn(cassandraLauncher % Test)
.settings(
name := "akka-persistence-cassandra",
libraryDependencies ++= Dependencies.akkaPersistenceCassandraDependencies ++ Dependencies.silencer,
Expand Down Expand Up @@ -74,9 +68,7 @@ lazy val docs = project
"javadoc.akka.base_url" -> s"https://doc.akka.io/japi/akka/${Dependencies.AkkaVersionInDocs}/",
// Alpakka
"extref.alpakka.base_url" -> s"https://doc.akka.io/docs/alpakka/${Dependencies.AlpakkaVersionInDocs}/%s",
// TODO switch this
// "scaladoc.akka.stream.alpakka.base_url" -> s"https://doc.akka.io/api/akka/${Dependencies.AlpakkaVersionInDocs}/",
"scaladoc.akka.stream.alpakka.base_url" -> s"/${(Preprocess / siteSubdirName).value}/",
"scaladoc.akka.stream.alpakka.base_url" -> s"https://doc.akka.io/api/alpakka/${Dependencies.AlpakkaVersionInDocs}/",
"javadoc.akka.stream.alpakka.base_url" -> "",
// Cassandra
"extref.cassandra.base_url" -> s"https://cassandra.apache.org/doc/${Dependencies.CassandraVersionInDocs}/%s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package akka.persistence.cassandra.reconciler

import com.typesafe.config.Config
import akka.annotation.InternalApi

final class ReconciliationSettings(config: Config) {

Expand Down
3 changes: 1 addition & 2 deletions docs/src/main/paradox/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Akka Persistence Cassandra

The Akka Persistence Cassandra plugin allows for using [Apache Cassandra](https://cassandra.apache.org) as a backend for @extref:[Akka Persistence](akka:persistence.html) and @extref:[Akka Persistence Query](akka:persistence-query.html).
The Akka Persistence Cassandra plugin allows for using [Apache Cassandra](https://cassandra.apache.org) as a backend for @extref:[Akka Persistence](akka:persistence.html) and @extref:[Akka Persistence Query](akka:persistence-query.html). It uses @extref:[Alpakka Cassandra](alpakka:cassandra.html) for Cassandra access which is based on the @extref:[Datastax Java Driver](java-driver:).

@@toc { depth=2 }

@@@ index

* [overview](overview.md)
* [Getting Started](getting-started.md)
* [Session](session.md)
* [Journal Plugin](journal.md)
* [Query Plugin](read-journal.md)
* [Events by tag](events-by-tag.md)
Expand Down
33 changes: 22 additions & 11 deletions docs/src/main/paradox/overview.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
# Overview

The Akka Persistence Cassandra plugin allows for using [Apache Cassandra](https://cassandra.apache.org) as a backend for @extref:[Akka Persistence](akka:persistence.html) and @extref:[Akka Persistence Query](akka:persistence-query.html).
The Akka Persistence Cassandra plugin allows for using [Apache Cassandra](https://cassandra.apache.org) as a backend for @extref:[Akka Persistence](akka:persistence.html) and @extref:[Akka Persistence Query](akka:persistence-query.html). It uses @extref:[Alpakka Cassandra](alpakka:cassandra.html) for Cassandra access which is based on the @extref:[Datastax Java Driver](java-driver:).

## Project Info

@@project-info{ projectId="core" }

## Dependencies

This plugin requires **Akka $akka.version$** or later. See [Akka's Binary Compatibility Rules](https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html) for details.

@@dependency [Maven,sbt,Gradle] {
group=com.typesafe.akka
artifact=akka-persistence-cassandra_$scala.binary.version$
version=$project.version$
symbol=AkkaVersion
value=$akka.version$
group1=com.typesafe.akka
artifact1=akka-persistence
version1=AkkaVersion
group2=com.typesafe.akka
artifact2=akka-persistence-query
version2=AkkaVersion
group3=com.typesafe.akka
artifact3=akka-cluster-tools
version3=AkkaVersion
}

This plugin build depends on Akka 2.5.x but the plugin will also work with Akka 2.6 (since Akka is [binary backwards compatible](https://doc.akka.io/docs/akka/current/common/binary-compatibility-rules.html#binary-compatibility-rules-explained)).

Note that it is important that all `akka-*` dependencies are in the same version, so it is recommended to depend on them explicitly to avoid problems with transient dependencies causing an unlucky mix of versions.

The table below shows Akka Persistence Cassandra’s direct dependencies and the second tab shows all libraries it depends on transitively.
Expand All @@ -24,14 +35,14 @@ The table below shows Akka Persistence Cassandra’s direct dependencies and the

## Snapshots

[sonatype-badge]: https://img.shields.io/nexus/s/https/oss.sonatype.org/com.typesafe.akka/akka-persistence-cassandra_2.12.svg?label=latest%20snapshot
[sonatype]: https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/akka-persistence-cassandra_2.12/
[bintray-badge]: https://api.bintray.com/packages/akka/snapshots/akka-persistence-cassandra/images/download.svg
[bintray]: https://bintray.com/akka/snapshots/akka-persistence-cassandra/_latestVersion

Snapshots are published to a snapshot repository in Sonatype after every successful build on master. Add the following to your project build definition to resolve snapshots:

sbt
: ```scala
resolvers += Resolver.sonatypeRepo("snapshots")
resolvers += Resolver.bintrayRepo("akka", "snapshots")
```

Maven
Expand All @@ -40,9 +51,9 @@ Maven
...
<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<id>akka-snapshots</id>
<name>Akka Snapshots</name>
<url>https://dl.bintray.com/akka/snapshots</url>
</repository>
</repositories>
...
Expand All @@ -53,12 +64,12 @@ Gradle
: ```gradle
repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
url "https://dl.bintray.com/akka/snapshots"
}
}
```

Latest published snapshot version is [![sonatype-badge][]][sonatype]
Latest published snapshot version is [![bintray-badge][]][bintray]

The [snapshot documentation](https://doc.akka.io/docs/akka-persistence-cassandra/snapshot/) is updated with every snapshot build.

Expand Down
134 changes: 0 additions & 134 deletions docs/src/main/paradox/session.md

This file was deleted.

3 changes: 2 additions & 1 deletion project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ object Common extends AutoPlugin {
Test / testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v", "-q"),
Test / parallelExecution := false,
bintrayOrganization := Some("akka"),
bintrayPackage := "akka-persistence-cassandra")
bintrayPackage := "akka-persistence-cassandra",
bintrayRepository := (if (isSnapshot.value) "snapshots" else "maven"))
}
23 changes: 3 additions & 20 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@ object Dependencies {
val AkkaVersion = System.getProperty("override.akka.version", "2.6.3")
val AkkaVersionInDocs = System.getProperty("override.akka.version", "2.6")
val CassandraVersionInDocs = "4.0"
val DriverVersion = "4.5.0"
val DriverVersionInDocs = DriverVersion.take(3)
val DriverVersionInDocs = "4.5"

// Performance dropped by ~40% when the driver upgraded to latest netty version
// override for now https://datastax-oss.atlassian.net/browse/JAVA-2676
val OverrideNettyVersion = "4.1.39.Final"

val AlpakkaVersion = "2.0.0-M3"
val AlpakkaVersion = "2.0.0-M3+16-49d6b5bf"
val AlpakkaVersionInDocs = "2.0"

val Logback = "ch.qos.logback" % "logback-classic" % "1.2.3"
Expand All @@ -26,19 +21,6 @@ object Dependencies {
compilerPlugin(("com.github.ghik" %% "silencer-plugin" % silencerVersion).cross(CrossVersion.patch)),
("com.github.ghik" %% "silencer-lib" % silencerVersion % Provided).cross(CrossVersion.patch))

val akkaCassandraSessionDependencies = Seq(
("com.datastax.oss" % "java-driver-core" % DriverVersion).exclude("com.github.spotbugs", "spotbugs-annotations"),
"io.netty" % "netty-handler" % OverrideNettyVersion,
"io.netty" % "netty-all" % OverrideNettyVersion,
"com.typesafe.akka" %% "akka-stream" % AkkaVersion,
"com.typesafe.akka" %% "akka-discovery" % AkkaVersion % Provided,
"com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion % Test,
"org.scalatest" %% "scalatest" % "3.1.0" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test,
"junit" % "junit" % "4.13" % Test,
Logback % Test)

val reconcilerDependencies = Seq(
"com.typesafe.akka" %% "akka-actor-testkit-typed" % AkkaVersion % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % AkkaVersion % Test)
Expand All @@ -55,6 +37,7 @@ object Dependencies {
"com.typesafe.akka" %% "akka-cluster-sharding")

val akkaPersistenceCassandraDependencies = Seq(
"com.lightbend.akka" %% "akka-stream-alpakka-cassandra" % AlpakkaVersion,
"com.typesafe.akka" %% "akka-persistence" % AkkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % AkkaVersion,
"com.typesafe.akka" %% "akka-cluster-tools" % AkkaVersion,
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")

// Documentation
addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.31")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-dependencies" % "0.2.1")
addSbtPlugin("com.lightbend.sbt" % "sbt-publish-rsync" % "0.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
22 changes: 0 additions & 22 deletions session/src/main/resources/reference.conf

This file was deleted.

Loading