r/programming • u/kloudmark • 56m ago
Cats-Actors 2.2.0 is released
cloudmark.github.ioCats-Actors is a Cats Effect native actor library: typed messages, functional state, supervision, and the familiar ! operator, all in F[_].
What is new in this release:
- ControlledTestKit, a new trait in the cats-actors-testkit module. It
provisions an ActorSystem[IO] inside Cats Effect's TestControl and ticks the
simulated clock for you, so scheduled work and timeouts resolve without real
waiting. A one hour receive timeout is now an ordinary unit test that finishes
in milliseconds.
- Receive timeouts, the supervisor restart window and the dead letter mailbox
idle check now read Clock[F].monotonic instead of System.currentTimeMillis, so
they all honour simulated time.
- New TestKit assertions, expectMsgTypeCountN and expectMsgTypeSingle, which
count messages of a type and do not depend on when they arrive relative to
the call.
- Breaking: ActorSystem.uptime is now F[Long] rather than Long.
Scala 2.13 and 3, on JVM, Scala.js and Scala Native.
```
resolvers += "jitpack" at "https://jitpack.io"
libraryDependencies += "com.github.cloudmark.cats-actors" %%% "cats-actors" % "2.2.0"
libraryDependencies += "com.github.cloudmark.cats-actors" %%% "cats-actors-testkit" % "2.2.0" % Test
```
Write up: https://cloudmark.github.io/Cats-Actors-Controlling-Time/
Repo: https://github.com/cloudmark/cats-actors
Feedback and issues welcome.