From bcf398b19d1e20cc5618c93378876a509d53e6d1 Mon Sep 17 00:00:00 2001 From: catostrophe <40268503+catostrophe@users.noreply.github.com> Date: Wed, 9 Sep 2020 09:36:20 +0300 Subject: [PATCH] update dependencies --- build.sbt | 2 +- .../examples/AckerConsumerDemo.scala | 9 ++++--- .../fs2rabbit/examples/IOAckerConsumer.scala | 1 - .../examples/ZIOAutoAckConsumer.scala | 6 ++--- project/Dependencies.scala | 10 +++---- project/plugins.sbt | 2 +- site/docs/examples/sample-acker.md | 2 +- site/docs/examples/sample-autoack.md | 2 +- .../fs2rabbit/interpreter/Fs2RabbitSpec.scala | 26 ++++++++----------- .../resiliency/ResilientStreamSpec.scala | 4 +-- 10 files changed, 30 insertions(+), 34 deletions(-) diff --git a/build.sbt b/build.sbt index e1565cac..3ce67442 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ import Dependencies._ import microsites.ExtraMdFileConfig ThisBuild / name := """fs2-rabbit""" -ThisBuild / crossScalaVersions := List("2.12.10", "2.13.1") +ThisBuild / crossScalaVersions := List("2.12.12", "2.13.3") ThisBuild / organization := "dev.profunktor" ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/")) ThisBuild / licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) diff --git a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/AckerConsumerDemo.scala b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/AckerConsumerDemo.scala index 0a5a6e2e..c457e452 100644 --- a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/AckerConsumerDemo.scala +++ b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/AckerConsumerDemo.scala @@ -38,9 +38,10 @@ class AckerConsumerDemo[F[_]: Concurrent: Timer](fs2Rabbit: RabbitClient[F]) { implicit val stringMessageEncoder = Kleisli[F, AmqpMessage[String], AmqpMessage[Array[Byte]]](s => s.copy(payload = s.payload.getBytes(UTF_8)).pure[F]) - def logPipe: Pipe[F, AmqpEnvelope[String], AckResult] = _.evalMap { amqpMsg => - putStrLn(s"Consumed: $amqpMsg").as(Ack(amqpMsg.deliveryTag)) - } + def logPipe: Pipe[F, AmqpEnvelope[String], AckResult] = + _.evalMap { amqpMsg => + putStrLn(s"Consumed: $amqpMsg").as(Ack(amqpMsg.deliveryTag)) + } val publishingFlag: PublishingFlag = PublishingFlag(mandatory = true) @@ -91,7 +92,7 @@ class Flow[F[_]: Concurrent, A]( val flow: Stream[F, Unit] = Stream( Stream(simpleMessage).covary[F].evalMap(publisher), - Stream(classMessage).covary[F].through(jsonPipe).evalMap(publisher), + Stream(classMessage).through(jsonPipe).covary[F].evalMap(publisher), consumer.through(logger).evalMap(acker) ).parJoin(3) diff --git a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/IOAckerConsumer.scala b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/IOAckerConsumer.scala index 8fc929e3..cd6f1cf4 100644 --- a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/IOAckerConsumer.scala +++ b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/IOAckerConsumer.scala @@ -20,7 +20,6 @@ import java.util.concurrent.Executors import cats.data.NonEmptyList import cats.effect._ -import cats.syntax.functor._ import dev.profunktor.fs2rabbit.config.{Fs2RabbitConfig, Fs2RabbitNodeConfig} import dev.profunktor.fs2rabbit.interpreter.RabbitClient import dev.profunktor.fs2rabbit.resiliency.ResilientStream diff --git a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/ZIOAutoAckConsumer.scala b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/ZIOAutoAckConsumer.scala index 2fe14a6d..ff557850 100644 --- a/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/ZIOAutoAckConsumer.scala +++ b/examples/src/main/scala/dev/profunktor/fs2rabbit/examples/ZIOAutoAckConsumer.scala @@ -46,7 +46,7 @@ object ZIOAutoAckConsumer extends CatsApp { .make(Task(Executors.newCachedThreadPool()))(es => Task(es.shutdown())) .map(Blocker.liftExecutorService) - override def run(args: List[String]): UIO[Int] = + override def run(args: List[String]): URIO[ZEnv, ExitCode] = blockerResource .use { blocker => RabbitClient[Task](config, blocker).flatMap { client => @@ -54,7 +54,7 @@ object ZIOAutoAckConsumer extends CatsApp { .runF(new AutoAckConsumerDemo[Task](client).program) } } - .run - .map(_ => 0) + .orDie + .as(ExitCode.success) } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 3de41b33..c9a57de1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,14 +4,14 @@ object Dependencies { object Version { val cats = "2.2.0" - val catsEffect = "2.1.2" - val fs2 = "2.3.0" + val catsEffect = "2.2.0" + val fs2 = "2.4.4" val circe = "0.13.0" val amqpClient = "5.9.0" val logback = "1.2.3" - val monix = "3.1.0" - val zio = "1.0.0-RC19-2" - val zioCats = "2.0.0.0-RC14" + val monix = "3.2.2" + val zio = "1.0.1" + val zioCats = "2.1.4.0" val scodec = "1.0.0" val dropwizard = "4.1.12.1" diff --git a/project/plugins.sbt b/project/plugins.sbt index c82f0f6e..d3180e43 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releas addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.1.4") addSbtPlugin("com.scalapenos" % "sbt-prompt" % "1.0.2") addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16") addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.13") +addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1") diff --git a/site/docs/examples/sample-acker.md b/site/docs/examples/sample-acker.md index 76b8afd6..6caf0c14 100644 --- a/site/docs/examples/sample-acker.md +++ b/site/docs/examples/sample-acker.md @@ -46,7 +46,7 @@ class Flow[F[_]: Concurrent, A]( val flow: Stream[F, Unit] = Stream( Stream(simpleMessage).covary[F].evalMap(publisher), - Stream(classMessage).covary[F].through(jsonPipe).evalMap(publisher), + Stream(classMessage).through(jsonPipe).covary[F].evalMap(publisher), consumer.through(logger).evalMap(acker) ).parJoin(3) diff --git a/site/docs/examples/sample-autoack.md b/site/docs/examples/sample-autoack.md index 1c67e11f..a1281b53 100644 --- a/site/docs/examples/sample-autoack.md +++ b/site/docs/examples/sample-autoack.md @@ -45,7 +45,7 @@ class AutoAckFlow[F[_]: Concurrent, A]( val flow: Stream[F, Unit] = Stream( Stream(simpleMessage).covary[F] evalMap publisher, - Stream(classMessage).covary[F] through jsonPipe evalMap publisher, + Stream(classMessage).through(jsonPipe).covary[F] evalMap publisher, consumer.through(logger).evalMap(ack => Sync[F].delay(println(ack))) ).parJoin(3) diff --git a/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala b/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala index 19c6e4f1..7b2b7175 100644 --- a/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala +++ b/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala @@ -115,9 +115,7 @@ trait Fs2RabbitSpec { self: BaseSpec => for { queue <- mkRandomString.map(QueueName) result <- declareQueuePassive(queue).attempt - } yield { - result.left.value shouldBe a[java.io.IOException] - } + } yield result.left.value shouldBe a[java.io.IOException] } } @@ -129,9 +127,7 @@ trait Fs2RabbitSpec { self: BaseSpec => for { exchange <- mkRandomString.map(ExchangeName) result <- declareExchangePassive(exchange).attempt - } yield { - result.left.value shouldBe a[java.io.IOException] - } + } yield result.left.value shouldBe a[java.io.IOException] } } @@ -188,9 +184,7 @@ trait Fs2RabbitSpec { self: BaseSpec => _ <- bindQueue(q, x, rk, QueueBindingArgs(Map.empty)) ct <- mkRandomString.map(ConsumerTag) result <- basicCancel(ct).attempt - } yield { - result.left.value shouldBe a[java.io.IOException] - } + } yield result.left.value shouldBe a[java.io.IOException] } } @@ -686,7 +680,7 @@ trait Fs2RabbitSpec { self: BaseSpec => RabbitClient[IO](config, blocker).flatMap(r => fa(r).compile.drain) } .as(emptyAssertion) - .unsafeToFuture + .unsafeToFuture() private def withStreamNackRabbit[A](fa: RabbitClient[IO] => Stream[IO, A]): Future[Assertion] = blockerResource @@ -694,7 +688,7 @@ trait Fs2RabbitSpec { self: BaseSpec => RabbitClient[IO](config.copy(requeueOnNack = true), blocker).flatMap(r => fa(r).compile.drain) } .as(emptyAssertion) - .unsafeToFuture + .unsafeToFuture() private def withStreamRejectRabbit[A](fa: RabbitClient[IO] => Stream[IO, A]): Future[Assertion] = blockerResource @@ -702,12 +696,14 @@ trait Fs2RabbitSpec { self: BaseSpec => RabbitClient[IO](config.copy(requeueOnReject = true), blocker).flatMap(r => fa(r).compile.drain) } .as(emptyAssertion) - .unsafeToFuture + .unsafeToFuture() private def withRabbit[A](fa: RabbitClient[IO] => IO[A]): Future[A] = - blockerResource.use { blocker => - RabbitClient[IO](config, blocker).flatMap(r => fa(r)) - }.unsafeToFuture + blockerResource + .use { blocker => + RabbitClient[IO](config, blocker).flatMap(r => fa(r)) + } + .unsafeToFuture() private def randomQueueData: IO[(QueueName, ExchangeName, RoutingKey)] = (mkRandomString, mkRandomString, mkRandomString).mapN { diff --git a/tests/src/test/scala/dev/profunktor/fs2rabbit/resiliency/ResilientStreamSpec.scala b/tests/src/test/scala/dev/profunktor/fs2rabbit/resiliency/ResilientStreamSpec.scala index b572999b..dd7531b6 100644 --- a/tests/src/test/scala/dev/profunktor/fs2rabbit/resiliency/ResilientStreamSpec.scala +++ b/tests/src/test/scala/dev/profunktor/fs2rabbit/resiliency/ResilientStreamSpec.scala @@ -33,7 +33,7 @@ class ResilientStreamSpec extends BaseSpec { it should "run a stream until it's finished" in { val program = Stream(1, 2, 3).covary[IO].through(sink) - ResilientStream.run(program).as(emptyAssertion).unsafeToFuture + ResilientStream.run(program).as(emptyAssertion).unsafeToFuture() } it should "run a stream and recover in case of failure" in { @@ -47,7 +47,7 @@ class ResilientStreamSpec extends BaseSpec { } } - Ref.of[IO, Int](2).flatMap(r => ResilientStream.run(p(r), 1.second)).as(emptyAssertion).unsafeToFuture + Ref.of[IO, Int](2).flatMap(r => ResilientStream.run(p(r), 1.second)).as(emptyAssertion).unsafeToFuture() } }