Akka-projection Getting Started Guide Example: Could not Run EventGeneratorApp

Hello
I was trying to run akka-projection Getting Started Guide Example located here:

I have been able to run tests at “Writing tests for a Projection” with success.

In part “Running the Projection” there is an EventGeneratorApp. In the example it says I should expect this line when I run it:

[2020-08-13 15:20:05,583] [INFO] [docs.guide.EventGeneratorApp$] [] [EventGenerator-akka.actor.default-dispatcher-22] - id [cb52b] tag [shopping-cart] event: ItemQuantityAdjusted(cb52b,skis,1,1) MDC: {persistencePhase=persist-evt, akkaAddress=akka://EventGenerator@127.0.1.1:25520, akkaSource=akka://EventGenerator/system/sharding/shopping-cart-event/678/cb52b, sourceActorSystem=EventGenerator, persistenceId=cb52b}

But when I run it, it does not behave as expected (see sbt log below).

I copied
1- sbt log
2-config file content
3- build.sbt

below.

I will appreciate your helps.

SBT LOG:

C:\src\AkkaProjections>sbt “runMain docs.guide.EventGeneratorApp”
[info] welcome to sbt 1.6.1 (Oracle Corporation Java 16.0.2)
[info] loading global plugins from C:\Users\ozcan_oz.sbt\1.0\plugins
[info] loading project definition from C:\src\AkkaProjections\project
[info] loading settings for project akkaprojections from build.sbt …
[info] set current project to AkkaProjections (in build file:/C:/src/AkkaProjections/)
[info] running docs.guide.EventGeneratorApp
SLF4J: A number (4) of logging calls during the initialization phase have been intercepted and are
SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system.
SLF4J: See also SLF4J Error Codes
[2022-01-20 18:11:21,318] [INFO] [akka.event.slf4j.Slf4jLogger] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Slf4jLogger started
[2022-01-20 18:11:21,797] [INFO] [akka.remote.artery.ArteryTransport] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Remoting started with transport [Artery tcp]; listening on address [akka://EventGeneratorApp@10.18.1.8:25520] with UID [6373220001417932044]
[2022-01-20 18:11:21,864] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Starting up, Akka version [2.6.18] …
[2022-01-20 18:11:21,979] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Registered cluster JMX MBean [akka:type=Cluster]
[2022-01-20 18:11:21,993] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Started up successfully
[2022-01-20 18:11:22,030] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - No downing-provider-class configured, manual cluster downing required, see Cluster Usage • Akka Documentation
[2022-01-20 18:11:22,030] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - No seed-nodes configured, manual cluster join required, see Cluster Usage • Akka Documentation
[2022-01-20 18:11:23,084] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaMemberChanged] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Node [akka://EventGeneratorApp@10.18.1.8:25520] is JOINING itself (with roles [dc-default], version [0.0.0]) and forming new cluster
[2022-01-20 18:11:23,090] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - is the new leader among reachable nodes (more leaders may exist)
[2022-01-20 18:11:23,112] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaMemberChanged] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Leader is moving node [akka://EventGeneratorApp@10.18.1.8:25520] to [Up]
[success] Total time: 5 s, completed 20 Oca 2022 18:11:23
[2022-01-20 18:11:23,130] [INFO] [akka.cluster.sharding.typed.scaladsl.ClusterSharding] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Starting Shard Region [shopping-cart-event]…
[2022-01-20 18:11:23,178] [INFO] [akka.cluster.sharding.ShardRegion] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - shopping-cart-event: Idle entities will be passivated after [2.000 min], checked every [1.000 min]
[2022-01-20 18:11:23,203] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaClusterSingletonStarted] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Singleton manager starting singleton actor [akka://EventGeneratorApp/system/sharding/shopping-cart-eventCoordinator/singleton]
[2022-01-20 18:11:23,203] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - ClusterSingletonManager state change [Start → Oldest]
[2022-01-20 18:11:23,216] [INFO] [akka.cluster.sharding.DDataShardCoordinator] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - shopping-cart-event: ShardCoordinator was moved to the active state with [0] shards
[2022-01-20 18:11:23,451] [INFO] [akka.actor.CoordinatedShutdown] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Running CoordinatedShutdown with reason [JvmExitReason]
[2022-01-20 18:11:23,462] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Message [akka.actor.TimerSchedulerImpl$InfluenceReceiveTimeoutTimerMsg] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [1] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:23,465] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaMemberChanged] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Marked address [akka://EventGeneratorApp@10.18.1.8:25520] as [Leaving]
[2022-01-20 18:11:23,469] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Exited [akka://EventGeneratorApp@10.18.1.8:25520].
[2022-01-20 18:11:23,470] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Oldest observed OldestChanged: [akka://EventGeneratorApp@10.18.1.8:25520 → None]
[2022-01-20 18:11:23,471] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - ClusterSingletonManager state change [Oldest → WasOldest]
[2022-01-20 18:11:24,044] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaMemberChanged] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Leader is moving node [akka://EventGeneratorApp@10.18.1.8:25520] to [Exiting]
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemAdded] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [2] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemQuantityAdjusted] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [3] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemRemoved] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [4] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemAdded] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [5] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemQuantityAdjusted] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [6] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemQuantityAdjusted] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [7] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemQuantityAdjusted] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [8] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemRemoved] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [9] dead letters encountered. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,198] [INFO] [akka.actor.LocalActorRef] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaDeadLetter] [EventGeneratorApp-akka.actor.default-dispatcher-17] - Message [docs.guide.ShoppingCartEvents$ItemAdded] wrapped in [akka.cluster.sharding.typed.ShardingEnvelope] to Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] was not delivered. [10] dead letters encountered, no more dead letters will be logged in next [5.000 min]. If this is not an expected behavior then Actor[akka://EventGeneratorApp/system/sharding/shopping-cart-event#318796710] may have terminated unexpectedly. This logging can be turned off or adjusted with configuration settings ‘akka.log-dead-letters’ and ‘akka.log-dead-letters-during-shutdown’.
[2022-01-20 18:11:24,484] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - Singleton manager stopping singleton actor [akka://EventGeneratorApp/system/sharding/shopping-cart-eventCoordinator/singleton]
[2022-01-20 18:11:24,484] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-16] - ClusterSingletonManager state change [WasOldest → Stopping]
[2022-01-20 18:11:24,488] [INFO] [akka.cluster.singleton.ClusterSingletonManager] [akka://EventGeneratorApp@10.18.1.8:25520] [akkaClusterSingletonTerminated] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Singleton actor [akka://EventGeneratorApp/system/sharding/shopping-cart-eventCoordinator/singleton] was terminated
[2022-01-20 18:11:24,496] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Exiting completed
[2022-01-20 18:11:24,496] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Shutting down…
[2022-01-20 18:11:24,496] [INFO] [akka.cluster.Cluster] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Cluster Node [akka://EventGeneratorApp@10.18.1.8:25520] - Successfully shut down
[2022-01-20 18:11:24,505] [INFO] [akka.remote.RemoteActorRefProvider$RemotingTerminator] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Shutting down remote daemon.
[2022-01-20 18:11:24,505] [INFO] [akka.remote.RemoteActorRefProvider$RemotingTerminator] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Remote daemon shut down; proceeding with flushing remote transports.
[2022-01-20 18:11:24,522] [INFO] [akka.remote.RemoteActorRefProvider$RemotingTerminator] [akka://EventGeneratorApp@10.18.1.8:25520] [EventGeneratorApp-akka.actor.default-dispatcher-3] - Remoting shut down.

guide-shopping-cart-app.conf:

datastax-java-driver {
advanced {
# reconnect to c* if down when app is started
reconnect-on-init = true
}
}

akka {
loglevel = DEBUG
actor {
serialization-bindings {
“docs.guide.CborSerializable” = jackson-cbor
“jdocs.guide.CborSerializable” = jackson-cbor
}
}

persistence.journal {
plugin = “akka.persistence.cassandra.journal”
auto-start-journals = [“akka.persistence.cassandra.journal”]
}
persistence.snapshot-store.plugin = “akka.persistence.cassandra.snapshot”

persistence {
cassandra {
journal {
# to create the schema
keyspace-autocreate = true
tables-autocreate = true
}

  snapshot {
    # to create the schema
    keyspace-autocreate = true
    tables-autocreate = true
  }

  query {
    refresh-interval = 2s
  }

  events-by-tag {
    # for lower latency
    eventual-consistency-delay = 25ms
    flush-interval = 25ms
    pubsub-notification = on
  }
}

}
}

build.sbt :

name := “AkkaProjections”

version := “0.1”

scalaVersion := “2.13.1”

val AkkaVersion = “2.6.18”
val AkkaHttpVersion = “10.2.7”

libraryDependencies += “com.lightbend.akka” %% “akka-projection-core” % “1.2.3”
libraryDependencies += “com.lightbend.akka” %% “akka-projection-eventsourced” % “1.2.3”
libraryDependencies += “com.lightbend.akka” %% “akka-projection-cassandra” % “1.2.3”
libraryDependencies += “com.lightbend.akka” %% “akka-projection-testkit” % “1.2.3”
libraryDependencies += “com.typesafe.akka” %% “akka-persistence-query” % AkkaVersion
libraryDependencies += “com.typesafe.akka” %% “akka-persistence-cassandra” % “1.0.5”
libraryDependencies +=“com.typesafe.akka” %% “akka-actor-testkit-typed” % AkkaVersion % Test
libraryDependencies +=“org.scalatest” %% “scalatest” % “3.2.9” % Test
libraryDependencies += “com.typesafe.akka” %% “akka-cluster-typed” % AkkaVersion
libraryDependencies += “ch.qos.logback” % “logback-classic” % “1.2.10”
libraryDependencies += “com.typesafe.akka” %% “akka-cluster-sharding-typed” % AkkaVersion
libraryDependencies += “com.typesafe.akka” %% “akka-persistence-typed” % AkkaVersion
libraryDependencies += “com.typesafe.akka” %% “akka-serialization-jackson” % AkkaVersion

That could perhaps be explained by a recent change in sbt causing processes to exit when you sbt run them, try changing the run to forked in build.sbt with an entry like this fork := true .

Please let us know if this fixes the issue so we can update the example project accordingly, thanks!

Sorry. I was busy with other coding. I will be checking it as soon as possible.

This solution did the job for me. I was trying to run two instances of the same project with sbt, making conflicts.