You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "mario-renau-alstom (via GitHub)" <gi...@apache.org> on 2023/08/15 09:59:38 UTC
[GitHub] [incubator-pekko-samples] mario-renau-alstom opened a new pull request, #65: Feature/missing workresults actor
mario-renau-alstom opened a new pull request, #65:
URL: https://github.com/apache/incubator-pekko-samples/pull/65
The README.md file mentions and non-existing `WorkResultConsumerActor` that consumes results and logs them.
I have created this actor that consumes the events generated by the WorkManager:
```scala
.withEventPublishing(enabled = true)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
[GitHub] [incubator-pekko-samples] pjfanning commented on a diff in pull request #65: Added missing WorkResultConsumerActor
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #65:
URL: https://github.com/apache/incubator-pekko-samples/pull/65#discussion_r1294413397
##########
pekko-sample-distributed-workers-scala/src/main/scala/worker/Main.scala:
##########
@@ -2,12 +2,12 @@ package worker
import java.io.File
import java.util.concurrent.CountDownLatch
-
import org.apache.pekko.actor.typed.ActorSystem
-import org.apache.pekko.actor.typed.scaladsl.Behaviors
+import org.apache.pekko.actor.typed.scaladsl.{ActorContext, Behaviors}
import org.apache.pekko.cluster.typed.Cluster
import org.apache.pekko.persistence.cassandra.testkit.CassandraLauncher
-import com.typesafe.config.{ Config, ConfigFactory }
+import com.typesafe.config.{Config, ConfigFactory}
Review Comment:
Can you change the import back? Our scalafmt style require the spaces before/after the braces. You will need to fix the new import above too.
##########
pekko-sample-distributed-workers-scala/src/main/scala/worker/WorkResultConsumerActor.scala:
##########
@@ -0,0 +1,24 @@
+package worker
+
+import org.apache.pekko.actor.typed.Behavior
+import org.apache.pekko.actor.typed.scaladsl.{ActorContext, Behaviors}
+import org.apache.pekko.persistence.typed.PublishedEvent
+
+object WorkResultConsumerActor {
+ def apply(): Behavior[PublishedEvent] =
+ Behaviors.setup { context =>
+ context.log.info("WorkResultConsumerActor started")
+
+ Behaviors.receiveMessage { message =>
+ handleReceivedEvent(context, message)
+ Behaviors.same
+ }
+ }
+
+ private def handleReceivedEvent(context: ActorContext[PublishedEvent], event: PublishedEvent): Unit = {
+ event.event match {
+ case WorkState.WorkInProgressReset | WorkState.WorkCompleted | WorkState.WorkStarted | WorkState.WorkAccepted =>
+ context.log.info(s"Received published event [${event.event.getClass.getCanonicalName}]: {}", event)
+ }
+ }
+}
Review Comment:
please add a new line at the end of the file
##########
pekko-sample-distributed-workers-scala/src/main/scala/worker/WorkManager.scala:
##########
@@ -119,6 +119,8 @@ object WorkManager {
// Any in progress work from the previous incarnation is retried
ctx.self ! ResetWorkInProgress
}
+ // Publish events to the system event stream as PublishedEvent after they have been persisted
Review Comment:
could you try using `sbt scalafmtAll`? - this formatting may fail our checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
[GitHub] [incubator-pekko-samples] mario-renau-alstom closed pull request #65: Added missing WorkResultConsumerActor
Posted by "mario-renau-alstom (via GitHub)" <gi...@apache.org>.
mario-renau-alstom closed pull request #65: Added missing WorkResultConsumerActor
URL: https://github.com/apache/incubator-pekko-samples/pull/65
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org