This is an automated email from the ASF dual-hosted git repository.
pjfanning pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-samples.git
The following commit(s) were added to refs/heads/main by this push:
new 56ddd8e Fix TransformCompleted parameters in Frontend.scala (#191)
56ddd8e is described below
commit 56ddd8e09adf80dc0b98a77bf51d478f3b401086
Author: PJ Fanning <[email protected]>
AuthorDate: Sat Oct 10 09:19:43 2026 +0100
Fix TransformCompleted parameters in Frontend.scala (#191)
* Fix TransformCompleted parameters in Frontend.scala
* Update Frontend.scala
---
.../src/main/scala/sample/cluster/transformation/Frontend.scala | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/Frontend.scala
b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/Frontend.scala
index 4353edf..a1b6bde 100644
---
a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/Frontend.scala
+++
b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/Frontend.scala
@@ -51,9 +51,11 @@ object Frontend {
val selectedWorker = workers(jobCounter % workers.size)
ctx.log.info("Sending work for processing to {}", selectedWorker)
val text = s"hello-$jobCounter"
- ctx.ask(selectedWorker, Worker.TransformText(text, _)) {
+ // the type params are explicit because Scala 3.3 cannot infer the
response type here: ActorRef is
+ // contravariant, so TextTransformed is only a lower bound for it
and gets widened to Any
+ ctx.ask[Worker.TransformText,
Worker.TextTransformed](selectedWorker, Worker.TransformText(text, _)) {
case Success(transformedText) =>
-
TransformCompleted(transformedText.asInstanceOf[Worker.TransformText].text,
text)
+ TransformCompleted(text, transformedText.text)
case Failure(ex) => JobFailed("Processing timed out", text)
}
running(ctx, workers, jobCounter + 1)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]