Skip to content
Open
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
148 changes: 65 additions & 83 deletions actor-model-with-scala/pom.xml
Original file line number Diff line number Diff line change
@@ -1,95 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.github.techshithoughts</groupId>
<artifactId>actor-model-with-scala</artifactId>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.github.techshithoughts</groupId>
<artifactId>actor-model-with-scala</artifactId>
<version>1.0.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<scala.version>3.3.5</scala.version>
<scala.binary.version>3</scala.binary.version>
<akka.version>2.6.21</akka.version>
<sttp.version>4.0.0-M24</sttp.version>
<scalatest.version>3.2.19</scalatest.version>
<scala.maven.plugin.version>4.5.6</scala.maven.plugin.version>
<logback-classic.version>1.4.12</logback-classic.version>
<slf4j-api.version>2.0.9</slf4j-api.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-bom_${scala.binary.version}</artifactId>
<version>${akka.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<scala.version>3.3.5</scala.version>
<apache.pekko.version>1.1.3</apache.pekko.version>
<sttp.version>4.0.0-M24</sttp.version>
<scalatest.version>3.2.19</scalatest.version>
<scala.maven.plugin.version>4.5.6</scala.maven.plugin.version>
<logback-classic.version>1.4.12</logback-classic.version>
<slf4j-api.version>2.0.9</slf4j-api.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala3-library_${scala.binary.version}</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor-typed_${scala.binary.version}</artifactId>
<version>${akka.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor-testkit-typed_${scala.binary.version}</artifactId>
<version>${akka.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
<scope>runtime</scope>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-bom_3</artifactId>
<version>${apache.pekko.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-actor-typed_3</artifactId>
<version>${apache.pekko.version}</version>
</dependency>
<dependency>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-actor-testkit-typed_3</artifactId>
<version>${apache.pekko.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-slf4j_3</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down Expand Up @@ -129,7 +96,22 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala.maven.plugin.version}</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
package com.github.techshithoughts.actor_model_with_scala


import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import com.github.techshithoughts.actor_model_with_scala.actors.DemoExecutorHelper



object Main extends App {

// Create an actor system
val system = ActorSystem("my-system")

// Use the correct method from DemoExecutorHelper
val system = ActorSystem("techshi-thoughts-actor-model-with-scala")
DemoExecutorHelper.statelessWorkerExampleWithLogging(system)

system.terminate()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.github.techshithoughts.actor_model_with_scala.actors
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import akka.actor.{ActorSystem, Props, ActorRef}
import akka.pattern.ask
import akka.util.Timeout
import org.apache.pekko.actor.{ActorSystem, Props, ActorRef}
import org.apache.pekko.pattern.ask
import org.apache.pekko.util.Timeout

import com.github.techshithoughts.actor_model_with_scala.actors.stateful._
import com.github.techshithoughts.actor_model_with_scala.actors.stateless._
Expand Down Expand Up @@ -114,6 +114,6 @@ object DemoExecutorHelper {
workerRafaelActor
)
}


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.github.techshithoughts.actor_model_with_scala.actors

import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.pattern.ask
import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, Props}
import org.apache.pekko.pattern.ask
import org.apache.pekko.util.Timeout
import scala.concurrent.{Future, ExecutionContext}
import scala.concurrent.duration.DurationInt
import com.github.techshithoughts.actor_model_with_scala.actors.stateful.messages._
Expand All @@ -22,7 +23,7 @@ object SlackMessageCoordinator {
)
}

import akka.util.Timeout


class SlackMessageCoordinator(implicit ec: ExecutionContext)
extends Actor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.techshithoughts.actor_model_with_scala.actors.simple

import akka.actor.{Actor, ActorLogging}
import org.apache.pekko.actor.{Actor, ActorLogging}
import com.github.techshithoughts.actor_model_with_scala.actors.simple.messages.{IntMessage, StringMessage, DoubleMessage}

class SimpleActorAsk extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.techshithoughts.actor_model_with_scala.actors.simple

import akka.actor.{Actor, ActorLogging}
import org.apache.pekko.actor.{Actor, ActorLogging}
import com.github.techshithoughts.actor_model_with_scala.actors.simple.messages.{IntMessage, StringMessage, DoubleMessage}

class SimpleActorSender extends Actor with ActorLogging {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.github.techshithoughts.actor_model_with_scala.actors.stateful

import akka.actor.Actor
import akka.actor.ActorLogging
import com.github.techshithoughts.actor_model_with_scala.actors.stateful.messages._
import akka.actor.Props
import org.apache.pekko.actor.Actor
import org.apache.pekko.actor.ActorLogging
import com.github.techshithoughts.actor_model_with_scala.actors.stateful.messages.*
import org.apache.pekko.actor.Props
import org.apache.pekko.actor.ActorLogging

object StatefulActor {
def props(name: String, status: WorkerStatusStateful): Props = Props(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.techshithoughts.actor_model_with_scala.actors.stateless

import akka.actor.{Actor, ActorLogging, Props}
import org.apache.pekko.actor.{Actor, ActorLogging, Props}
import com.github.techshithoughts.actor_model_with_scala.actors.stateless.messages._

// Companion object for StatelessActor, providing a factory method to create actor instances
Expand Down
10 changes: 5 additions & 5 deletions actor-model-with-scala/src/main/scala/resources/application.conf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

akka {
pekko {
# Set the log level for Akka
loglevel = "INFO"
# Set the log level for stdout
stdout-loglevel = "WARNING"
# Specify the loggers to use
loggers = ["akka.event.Logging$DefaultLogger"]
loggers = ["org.apache.pekko.event.slf4j.Slf4jLogger"]
# Specify the logging filter
logging-filter = "akka.event.DefaultLoggingFilter"
logging-filter = "org.apache.pekko.event.slf4j.Slf4jLoggingFilter"
# Timeout for logger startup
logger-startup-timeout = 5s
# Number of dead letters to log
Expand All @@ -20,6 +20,6 @@ akka {
jvm-exit-on-fatal-error = on
# Enable JVM shutdown hooks
jvm-shutdown-hooks = on
# Fail on mixed Akka versions
# Fail on mixed Pekko versions
fail-mixed-versions = on
}
}