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

fix: EventWriter snapshot event #1048

Merged
merged 2 commits into from
Oct 25, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,23 @@ import akka.projection.grpc.internal.proto.EventConsumerServicePowerApi
import akka.stream.scaladsl.Source
import io.grpc.Status
import org.slf4j.LoggerFactory

import scala.concurrent.ExecutionContext
import scala.concurrent.Promise

import akka.persistence.query.typed.EventEnvelope

/**
* INTERNAL API
*/
@InternalApi
private[akka] object EventPusherConsumerServiceImpl {
// See akka.persistence.r2dbc.internal.EnvelopeOrigin, but we don't have a dependency
// to akka-persistence-r2dbc here
def fromSnapshot(env: EventEnvelope[_]): Boolean =
env.source == "SN"

}

/**
* INTERNAL API
*
Expand All @@ -40,6 +53,7 @@ private[akka] final class EventPusherConsumerServiceImpl(
preferProtobuf: ProtoAnySerialization.Prefer)(implicit system: ActorSystem[_])
extends EventConsumerServicePowerApi {

import EventPusherConsumerServiceImpl.fromSnapshot
import ProtobufProtocolConversions._

private val logger = LoggerFactory.getLogger(classOf[EventPusherConsumerServiceImpl])
Expand Down Expand Up @@ -134,6 +148,7 @@ private[akka] final class EventPusherConsumerServiceImpl(
transformedEventEnvelope.persistenceId,
transformedEventEnvelope.sequenceNr,
transformedEventEnvelope.eventOption.getOrElse(FilteredPayload),
isSnapshotEvent = fromSnapshot(transformedEventEnvelope),
transformedEventEnvelope.eventMetadata,
transformedEventEnvelope.tags,
_))(destination.eventProducerPushDestination.settings.journalWriteTimeout, system.scheduler)
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object Dependencies {
val AkkaProjectionVersionInDocs = "1.5"

object Versions {
val akka = sys.props.getOrElse("build.akka.version", "2.9.0-M3")
val akka = sys.props.getOrElse("build.akka.version", "2.9.0")
val akkaPersistenceCassandra = "1.2.0-M1"
val akkaPersistenceJdbc = "5.3.0-M1"
val akkaPersistenceR2dbc = "1.2.0-M7"
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/iot-service-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = "2.9.0-M3"
val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M7"
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/local-drone-control-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.9.0-M3</akka.version>
<akka.version>2.9.0</akka.version>
<akka-projection.version>1.5.0-M5</akka-projection.version>
<akka-persistence-r2dbc.version>1.2.0-M7</akka-persistence-r2dbc.version>
<akka-management.version>1.5.0-M1</akka-management.version>
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/local-drone-control-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = "2.9.0-M3"
val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.9.0-M3</akka.version>
<akka.version>2.9.0</akka.version>
<akka-projection.version>1.5.0-M5</akka-projection.version>
<akka-persistence-r2dbc.version>1.2.0-M6</akka-persistence-r2dbc.version>
<akka-management.version>1.5.0-M1</akka-management.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = "2.9.0-M3"
val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M6"
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/shopping-analytics-service-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.9.0-M3</akka.version>
<akka.version>2.9.0</akka.version>
<akka-projection.version>1.5.0-M5</akka-projection.version>
<akka-persistence-r2dbc.version>1.2.0-M7</akka-persistence-r2dbc.version>
<akka-management.version>1.5.0-M1</akka-management.version>
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/shopping-analytics-service-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = "2.9.0-M3"
val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M7"
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/shopping-cart-service-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.9.0-M3</akka.version>
<akka.version>2.9.0</akka.version>
<akka-projection.version>1.5.0-M5</akka-projection.version>
<akka-persistence-r2dbc.version>1.2.0-M7</akka-persistence-r2dbc.version>
<akka-management.version>1.5.0-M1</akka-management.version>
Expand Down
2 changes: 1 addition & 1 deletion samples/grpc/shopping-cart-service-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = "2.9.0-M3"
val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M7"
Expand Down
2 changes: 1 addition & 1 deletion samples/replicated/shopping-cart-service-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<akka.version>2.9.0-M3</akka.version>
<akka.version>2.9.0</akka.version>
<akka-projection.version>1.5.0-M5</akka-projection.version>
<akka-persistence-r2dbc.version>1.2.0-M7</akka-persistence-r2dbc.version>
<akka-management.version>1.5.0-M1</akka-management.version>
Expand Down
2 changes: 1 addition & 1 deletion samples/replicated/shopping-cart-service-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ run / javaOptions ++= sys.props
.fold(Seq.empty[String])(res => Seq(s"-Dconfig.resource=$res"))
Global / cancelable := false // ctrl-c

val AkkaVersion = sys.props.getOrElse("akka.version", "2.9.0-M3")
val AkkaVersion = sys.props.getOrElse("akka.version", "2.9.0")
val AkkaHttpVersion = "10.6.0-M2"
val AkkaManagementVersion = "1.5.0-M1"
val AkkaPersistenceR2dbcVersion = "1.2.0-M7"
Expand Down