diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala deleted file mode 100644 index e7e6627..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala +++ /dev/null @@ -1,19 +0,0 @@ -package works.iterative.akka - -// Base class for all command-processing related exceptions from handlers -sealed abstract class CommandHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandNotAvailable[C, S](cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd není dostupný ve stavu $state" - ) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandRejected[C, S](reason: String, cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala deleted file mode 100644 index e7e6627..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala +++ /dev/null @@ -1,19 +0,0 @@ -package works.iterative.akka - -// Base class for all command-processing related exceptions from handlers -sealed abstract class CommandHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandNotAvailable[C, S](cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd není dostupný ve stavu $state" - ) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandRejected[C, S](reason: String, cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala deleted file mode 100644 index 72a5bf9..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala +++ /dev/null @@ -1,11 +0,0 @@ -package works.iterative.akka - -sealed abstract class EventHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -case class UnhandledEvent[Event, State](event: Event, state: State) - extends EventHandlerException( - s"Událost $event nastala ve stavu $state bez možnosti zpracování" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala deleted file mode 100644 index e7e6627..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala +++ /dev/null @@ -1,19 +0,0 @@ -package works.iterative.akka - -// Base class for all command-processing related exceptions from handlers -sealed abstract class CommandHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandNotAvailable[C, S](cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd není dostupný ve stavu $state" - ) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandRejected[C, S](reason: String, cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala deleted file mode 100644 index 72a5bf9..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala +++ /dev/null @@ -1,11 +0,0 @@ -package works.iterative.akka - -sealed abstract class EventHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -case class UnhandledEvent[Event, State](event: Event, state: State) - extends EventHandlerException( - s"Událost $event nastala ve stavu $state bez možnosti zpracování" - ) diff --git a/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala new file mode 100644 index 0000000..6456863 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala @@ -0,0 +1,20 @@ +package works.iterative.akka + +import zio.* +import akka.actor.typed.ActorSystem +import akka.actor.typed.scaladsl.Behaviors +import akka.cluster.typed.Cluster +import akka.cluster.typed.Join + +case class AkkaActorSystem(system: ActorSystem[?]): + val joinSelf: Task[Unit] = ZIO.attempt { + val cluster = Cluster(system) + cluster.manager ! Join(cluster.selfMember.address) + } + +object AkkaActorSystem: + def empty(name: String): TaskLayer[AkkaActorSystem] = + ZLayer( + for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) + yield AkkaActorSystem(system) + ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala deleted file mode 100644 index e7e6627..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala +++ /dev/null @@ -1,19 +0,0 @@ -package works.iterative.akka - -// Base class for all command-processing related exceptions from handlers -sealed abstract class CommandHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandNotAvailable[C, S](cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd není dostupný ve stavu $state" - ) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandRejected[C, S](reason: String, cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala deleted file mode 100644 index 72a5bf9..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala +++ /dev/null @@ -1,11 +0,0 @@ -package works.iterative.akka - -sealed abstract class EventHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -case class UnhandledEvent[Event, State](event: Event, state: State) - extends EventHandlerException( - s"Událost $event nastala ve stavu $state bez možnosti zpracování" - ) diff --git a/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala new file mode 100644 index 0000000..6456863 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala @@ -0,0 +1,20 @@ +package works.iterative.akka + +import zio.* +import akka.actor.typed.ActorSystem +import akka.actor.typed.scaladsl.Behaviors +import akka.cluster.typed.Cluster +import akka.cluster.typed.Join + +case class AkkaActorSystem(system: ActorSystem[?]): + val joinSelf: Task[Unit] = ZIO.attempt { + val cluster = Cluster(system) + cluster.manager ! Join(cluster.selfMember.address) + } + +object AkkaActorSystem: + def empty(name: String): TaskLayer[AkkaActorSystem] = + ZLayer( + for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) + yield AkkaActorSystem(system) + ) diff --git a/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala new file mode 100644 index 0000000..e7e6627 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala @@ -0,0 +1,19 @@ +package works.iterative.akka + +// Base class for all command-processing related exceptions from handlers +sealed abstract class CommandHandlerException( + msg: String, + cause: Option[Throwable] = None +) extends Exception(msg, cause.orNull) + +// TODO: use a typeclass like "Show" to create the error message +case class CommandNotAvailable[C, S](cmd: C, state: S) + extends CommandHandlerException( + s"Příkaz $cmd není dostupný ve stavu $state" + ) + +// TODO: use a typeclass like "Show" to create the error message +case class CommandRejected[C, S](reason: String, cmd: C, state: S) + extends CommandHandlerException( + s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" + ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala deleted file mode 100644 index 6456863..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/AkkaActorSystem.scala +++ /dev/null @@ -1,20 +0,0 @@ -package works.iterative.akka - -import zio.* -import akka.actor.typed.ActorSystem -import akka.actor.typed.scaladsl.Behaviors -import akka.cluster.typed.Cluster -import akka.cluster.typed.Join - -case class AkkaActorSystem(system: ActorSystem[?]): - val joinSelf: Task[Unit] = ZIO.attempt { - val cluster = Cluster(system) - cluster.manager ! Join(cluster.selfMember.address) - } - -object AkkaActorSystem: - def empty(name: String): TaskLayer[AkkaActorSystem] = - ZLayer( - for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) - yield AkkaActorSystem(system) - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala deleted file mode 100644 index e7e6627..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/CommandHandlerException.scala +++ /dev/null @@ -1,19 +0,0 @@ -package works.iterative.akka - -// Base class for all command-processing related exceptions from handlers -sealed abstract class CommandHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandNotAvailable[C, S](cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd není dostupný ve stavu $state" - ) - -// TODO: use a typeclass like "Show" to create the error message -case class CommandRejected[C, S](reason: String, cmd: C, state: S) - extends CommandHandlerException( - s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" - ) diff --git a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala b/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala deleted file mode 100644 index 72a5bf9..0000000 --- a/akka-persistence/src/main/scala/fiftyforms/akka/EventHandlerException.scala +++ /dev/null @@ -1,11 +0,0 @@ -package works.iterative.akka - -sealed abstract class EventHandlerException( - msg: String, - cause: Option[Throwable] = None -) extends Exception(msg, cause.orNull) - -case class UnhandledEvent[Event, State](event: Event, state: State) - extends EventHandlerException( - s"Událost $event nastala ve stavu $state bez možnosti zpracování" - ) diff --git a/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala new file mode 100644 index 0000000..6456863 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/AkkaActorSystem.scala @@ -0,0 +1,20 @@ +package works.iterative.akka + +import zio.* +import akka.actor.typed.ActorSystem +import akka.actor.typed.scaladsl.Behaviors +import akka.cluster.typed.Cluster +import akka.cluster.typed.Join + +case class AkkaActorSystem(system: ActorSystem[?]): + val joinSelf: Task[Unit] = ZIO.attempt { + val cluster = Cluster(system) + cluster.manager ! Join(cluster.selfMember.address) + } + +object AkkaActorSystem: + def empty(name: String): TaskLayer[AkkaActorSystem] = + ZLayer( + for system <- ZIO.attempt(ActorSystem(Behaviors.empty, name)) + yield AkkaActorSystem(system) + ) diff --git a/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala b/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala new file mode 100644 index 0000000..e7e6627 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/CommandHandlerException.scala @@ -0,0 +1,19 @@ +package works.iterative.akka + +// Base class for all command-processing related exceptions from handlers +sealed abstract class CommandHandlerException( + msg: String, + cause: Option[Throwable] = None +) extends Exception(msg, cause.orNull) + +// TODO: use a typeclass like "Show" to create the error message +case class CommandNotAvailable[C, S](cmd: C, state: S) + extends CommandHandlerException( + s"Příkaz $cmd není dostupný ve stavu $state" + ) + +// TODO: use a typeclass like "Show" to create the error message +case class CommandRejected[C, S](reason: String, cmd: C, state: S) + extends CommandHandlerException( + s"Příkaz $cmd byl ve stavu $state odmítnut s odůvodněním $reason" + ) diff --git a/akka-persistence/src/main/scala/iw/akka/EventHandlerException.scala b/akka-persistence/src/main/scala/iw/akka/EventHandlerException.scala new file mode 100644 index 0000000..72a5bf9 --- /dev/null +++ b/akka-persistence/src/main/scala/iw/akka/EventHandlerException.scala @@ -0,0 +1,11 @@ +package works.iterative.akka + +sealed abstract class EventHandlerException( + msg: String, + cause: Option[Throwable] = None +) extends Exception(msg, cause.orNull) + +case class UnhandledEvent[Event, State](event: Event, state: State) + extends EventHandlerException( + s"Událost $event nastala ve stavu $state bez možnosti zpracování" + )