From 14e3c39f6d99ce47e3e6c0fd82d16759cfef5e53 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 28 Sep 2024 22:20:44 +0000 Subject: [PATCH 01/10] Update scala3-library to 3.3.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index f08961f2..37f57bac 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import microsites.ExtraMdFileConfig ThisBuild / name := "fs2-rabbit" ThisBuild / scalaVersion := "2.13.14" -ThisBuild / crossScalaVersions := List("2.12.20", "2.13.14", "3.3.3", "3.5.1") +ThisBuild / crossScalaVersions := List("2.12.20", "2.13.14", "3.3.4", "3.5.1") ThisBuild / versionScheme := Some("semver-spec") ThisBuild / organization := "dev.profunktor" ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/")) From b42a285d4dfba24dbb624b516dea437d9c1c21f8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 8 Oct 2024 20:24:41 +0000 Subject: [PATCH 02/10] Update logback-classic to 1.5.9 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d53c52b3..601711db 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,7 +8,7 @@ object Dependencies { val fs2 = "3.11.0" val circe = "0.14.10" val amqpClient = "5.22.0" - val logback = "1.5.8" + val logback = "1.5.9" val monix = "3.3.0" val zio = "1.0.18" val zioCats = "3.2.9.1" From 3cc1285de4be1f47268f4c833bb286a92fcdd148 Mon Sep 17 00:00:00 2001 From: David Geirola Date: Fri, 11 Oct 2024 11:11:50 +0200 Subject: [PATCH 03/10] Add syntax to simplify usage (#988) --- .../fs2rabbit/config/declaration.scala | 73 ++++++++++++++++++- .../fs2rabbit/config/deletion.scala | 20 ++++- .../fs2rabbit/model/AmqpProperties.scala | 2 +- .../profunktor/fs2rabbit/model/values.scala | 15 +++- .../testing/AmqpPropertiesArbs.scala | 2 +- .../fs2rabbit/interpreter/Fs2RabbitSpec.scala | 6 +- 6 files changed, 106 insertions(+), 12 deletions(-) diff --git a/core/src/main/scala/dev/profunktor/fs2rabbit/config/declaration.scala b/core/src/main/scala/dev/profunktor/fs2rabbit/config/declaration.scala index 09e6b7c5..1da2dfbd 100644 --- a/core/src/main/scala/dev/profunktor/fs2rabbit/config/declaration.scala +++ b/core/src/main/scala/dev/profunktor/fs2rabbit/config/declaration.scala @@ -16,11 +16,12 @@ package dev.profunktor.fs2rabbit.config -import dev.profunktor.fs2rabbit.arguments.Arguments +import dev.profunktor.fs2rabbit.arguments.{Arguments, SafeArg} import dev.profunktor.fs2rabbit.model.{ExchangeName, ExchangeType, QueueName, QueueType} object declaration { + // ----- Queue Config ----- final case class DeclarationQueueConfig( queueName: QueueName, durable: DurableCfg, @@ -43,6 +44,35 @@ object declaration { case None => Right(arguments) } + + // arguments + def withArguments(arguments: Arguments): DeclarationQueueConfig = + copy(arguments = arguments) + + def withArguments(arguments: (String, SafeArg)*): DeclarationQueueConfig = + withArguments(arguments.toMap) + + // durable + def withDurable: DeclarationQueueConfig = + copy(durable = Durable) + + def withNonDurable: DeclarationQueueConfig = + copy(durable = NonDurable) + + // autoDelete + def withAutoDelete: DeclarationQueueConfig = + copy(autoDelete = AutoDelete) + + def withNonAutoDelete: DeclarationQueueConfig = + copy(autoDelete = NonAutoDelete) + + // exclusive + def withExclusive: DeclarationQueueConfig = + copy(exclusive = Exclusive) + + def withNonExclusive: DeclarationQueueConfig = + copy(exclusive = NonExclusive) + } object DeclarationQueueConfig { @@ -78,6 +108,7 @@ object declaration { case object AutoDelete extends AutoDeleteCfg case object NonAutoDelete extends AutoDeleteCfg + // ----- Exchange Config ----- final case class DeclarationExchangeConfig( exchangeName: ExchangeName, exchangeType: ExchangeType, @@ -85,12 +116,48 @@ object declaration { autoDelete: AutoDeleteCfg, internal: InternalCfg, arguments: Arguments - ) + ) { + + // arguments + def withArguments(arguments: Arguments): DeclarationExchangeConfig = + copy(arguments = arguments) + + def withArguments(arguments: (String, SafeArg)*): DeclarationExchangeConfig = + withArguments(arguments.toMap) + + // durable + def withDurable: DeclarationExchangeConfig = + copy(durable = Durable) + + def withNonDurable: DeclarationExchangeConfig = + copy(durable = NonDurable) + + // autoDelete + def withAutoDelete: DeclarationExchangeConfig = + copy(autoDelete = AutoDelete) + + def withNonAutoDelete: DeclarationExchangeConfig = + copy(autoDelete = NonAutoDelete) + + // internal + def withInternal: DeclarationExchangeConfig = + copy(internal = Internal) + + def withNonInternal: DeclarationExchangeConfig = + copy(internal = NonInternal) + } object DeclarationExchangeConfig { def default(exchangeName: ExchangeName, exchangeType: ExchangeType): DeclarationExchangeConfig = - DeclarationExchangeConfig(exchangeName, exchangeType, NonDurable, NonAutoDelete, NonInternal, Map.empty) + DeclarationExchangeConfig( + exchangeName = exchangeName, + exchangeType = exchangeType, + durable = NonDurable, + autoDelete = NonAutoDelete, + internal = NonInternal, + arguments = Map.empty + ) } sealed trait InternalCfg extends Product with Serializable diff --git a/core/src/main/scala/dev/profunktor/fs2rabbit/config/deletion.scala b/core/src/main/scala/dev/profunktor/fs2rabbit/config/deletion.scala index 7841ab97..1c4363a2 100644 --- a/core/src/main/scala/dev/profunktor/fs2rabbit/config/deletion.scala +++ b/core/src/main/scala/dev/profunktor/fs2rabbit/config/deletion.scala @@ -27,15 +27,33 @@ object deletion { ) object DeletionQueueConfig { + + @deprecated("Use ifUnusedAndEmpty instead", "5.3.0") def default(queueName: QueueName): DeletionQueueConfig = + onlyIfUnusedAndEmpty(queueName) + + def onlyIfUnusedAndEmpty(queueName: QueueName): DeletionQueueConfig = DeletionQueueConfig(queueName, Unused, Empty) + + def evenIfUsedButEmpty(queueName: QueueName): DeletionQueueConfig = + DeletionQueueConfig(queueName, Used, Empty) + + def evenIfUsedAndNonEmpty(queueName: QueueName): DeletionQueueConfig = + DeletionQueueConfig(queueName, Used, NonEmpty) } final case class DeletionExchangeConfig(exchangeName: ExchangeName, ifUnused: IfUnusedCfg) - object DeletionExchangeConfig { + + @deprecated("Use ifUnused instead", "5.3.0") def default(exchangeName: ExchangeName): DeletionExchangeConfig = + onlyIfUnused(exchangeName) + + def onlyIfUnused(exchangeName: ExchangeName): DeletionExchangeConfig = DeletionExchangeConfig(exchangeName, Unused) + + def evenIfUsed(exchangeName: ExchangeName): DeletionExchangeConfig = + DeletionExchangeConfig(exchangeName, Used) } sealed trait IfEmptyCfg extends Product with Serializable diff --git a/core/src/main/scala/dev/profunktor/fs2rabbit/model/AmqpProperties.scala b/core/src/main/scala/dev/profunktor/fs2rabbit/model/AmqpProperties.scala index decb4338..1e510536 100644 --- a/core/src/main/scala/dev/profunktor/fs2rabbit/model/AmqpProperties.scala +++ b/core/src/main/scala/dev/profunktor/fs2rabbit/model/AmqpProperties.scala @@ -81,7 +81,7 @@ object AmqpProperties { contentType = Option(basicProps.getContentType), contentEncoding = Option(basicProps.getContentEncoding), priority = Option[Integer](basicProps.getPriority).map(Int.unbox), - deliveryMode = Option(basicProps.getDeliveryMode).map(DeliveryMode.from(_)), + deliveryMode = Option(basicProps.getDeliveryMode).map(DeliveryMode.unsafeFromInt(_)), correlationId = Option(basicProps.getCorrelationId), messageId = Option(basicProps.getMessageId), `type` = Option(basicProps.getType), diff --git a/core/src/main/scala/dev/profunktor/fs2rabbit/model/values.scala b/core/src/main/scala/dev/profunktor/fs2rabbit/model/values.scala index bb8d38c9..049203e5 100644 --- a/core/src/main/scala/dev/profunktor/fs2rabbit/model/values.scala +++ b/core/src/main/scala/dev/profunktor/fs2rabbit/model/values.scala @@ -95,9 +95,18 @@ object DeliveryMode { case object NonPersistent extends DeliveryMode(1) case object Persistent extends DeliveryMode(2) - def from(value: Int): DeliveryMode = value match { - case 1 => NonPersistent - case 2 => Persistent + @deprecated("Use fromInt or unsafeFromInt", "5.3.0") + def from(value: Int): DeliveryMode = + unsafeFromInt(value) + + def unsafeFromInt(value: Int): DeliveryMode = + fromInt(value) + .getOrElse(throw new IllegalArgumentException(s"Invalid delivery mode from Int: $value")) + + def fromInt(value: Int): Option[DeliveryMode] = value match { + case 1 => Some(NonPersistent) + case 2 => Some(Persistent) + case _ => None } implicit val deliveryModeOrder: Order[DeliveryMode] = Order.by(_.value) diff --git a/core/src/test/scala/dev/profunktor/fs2rabbit/testing/AmqpPropertiesArbs.scala b/core/src/test/scala/dev/profunktor/fs2rabbit/testing/AmqpPropertiesArbs.scala index d3d7cd0d..be33f431 100644 --- a/core/src/test/scala/dev/profunktor/fs2rabbit/testing/AmqpPropertiesArbs.scala +++ b/core/src/test/scala/dev/profunktor/fs2rabbit/testing/AmqpPropertiesArbs.scala @@ -166,7 +166,7 @@ object AmqpPropertiesArbs { contentType, contentEncoding, priority, - deliveryMode.map(DeliveryMode.from), + deliveryMode.map(DeliveryMode.unsafeFromInt), correlationId, messageId, messageType, 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 dfeb3bbf..82e07e34 100644 --- a/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala +++ b/tests/src/test/scala/dev/profunktor/fs2rabbit/interpreter/Fs2RabbitSpec.scala @@ -392,8 +392,8 @@ trait Fs2RabbitSpec { self: BaseSpec => (q, x, _) = qxrk _ <- declareExchange(x, ExchangeType.Direct) _ <- declareQueue(DeclarationQueueConfig.default(q)) - _ <- deleteQueue(DeletionQueueConfig.default(q)) - _ <- deleteQueueNoWait(DeletionQueueConfig.default(q)) + _ <- deleteQueue(DeletionQueueConfig.onlyIfUnusedAndEmpty(q)) + _ <- deleteQueueNoWait(DeletionQueueConfig.onlyIfUnusedAndEmpty(q)) consumer <- createAutoAckConsumer(q) _ <- consumer.attempt .take(1) @@ -415,7 +415,7 @@ trait Fs2RabbitSpec { self: BaseSpec => createConnectionChannel.use { implicit channel => mkRandomString.map(ExchangeName).flatMap { exchange => declareExchange(exchange, ExchangeType.Direct) *> - deleteExchangeNoWait(DeletionExchangeConfig.default(exchange)).attempt.map(_ shouldBe a[Right[_, _]]) + deleteExchangeNoWait(DeletionExchangeConfig.onlyIfUnused(exchange)).attempt.map(_ shouldBe a[Right[_, _]]) } } } From 1aad8431baaae00e2e7fa70dafd3972ab797240c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 11 Oct 2024 11:12:16 +0200 Subject: [PATCH 04/10] Update scala-library to 2.13.15 (#992) --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f08961f2..e9a8aad8 100644 --- a/build.sbt +++ b/build.sbt @@ -2,8 +2,8 @@ import Dependencies._ import microsites.ExtraMdFileConfig ThisBuild / name := "fs2-rabbit" -ThisBuild / scalaVersion := "2.13.14" -ThisBuild / crossScalaVersions := List("2.12.20", "2.13.14", "3.3.3", "3.5.1") +ThisBuild / scalaVersion := "2.13.15" +ThisBuild / crossScalaVersions := List("2.12.20", "2.13.15", "3.3.3", "3.5.1") ThisBuild / versionScheme := Some("semver-spec") ThisBuild / organization := "dev.profunktor" ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/")) From 4f9362ae93a7273c7e51536073dccd2129c238f4 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:00:04 +0200 Subject: [PATCH 05/10] Update sbt-ci-release to 1.8.0 (#998) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2cdcefc2..f1f30f8b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ resolvers += Classpaths.sbtPluginReleases resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/" -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.7.0") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.8.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.4") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.1") From 8956fd10307e076f21dff1c68ee6b51a7ad4514a Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:00:25 +0200 Subject: [PATCH 06/10] Update logback-classic to 1.5.10 (#997) --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 601711db..af66c765 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,7 +8,7 @@ object Dependencies { val fs2 = "3.11.0" val circe = "0.14.10" val amqpClient = "5.22.0" - val logback = "1.5.9" + val logback = "1.5.10" val monix = "3.3.0" val zio = "1.0.18" val zioCats = "3.2.9.1" From ae3c3e66a9342f5ab2c18fb27034495a246da46c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:01:22 +0200 Subject: [PATCH 07/10] Update logback-classic to 1.5.11 (#999) --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index af66c765..b4681135 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -8,7 +8,7 @@ object Dependencies { val fs2 = "3.11.0" val circe = "0.14.10" val amqpClient = "5.22.0" - val logback = "1.5.10" + val logback = "1.5.11" val monix = "3.3.0" val zio = "1.0.18" val zioCats = "3.2.9.1" From a0f2f9bb95ad281e68acaf6a513aa68f057a308c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:36:32 +0200 Subject: [PATCH 08/10] Update sbt-ci-release to 1.9.0 (#1001) --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index f1f30f8b..14331e67 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ resolvers += Classpaths.sbtPluginReleases resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/" -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.8.0") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.4") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.6.1") From 9484ea0f39f26eaf1bd64389b57f97de85266813 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:40:35 +0200 Subject: [PATCH 09/10] Update sbt, scripted-plugin to 1.10.3 (#1000) --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 0b699c30..bc739060 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.3 From 8283b0bfa4d390ef4b96061d6690ec154172d8aa Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:40:48 +0200 Subject: [PATCH 10/10] Update scala3-library to 3.5.2 (#1002) Co-authored-by: David Geirola --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index f2c541b3..6d682717 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import microsites.ExtraMdFileConfig ThisBuild / name := "fs2-rabbit" ThisBuild / scalaVersion := "2.13.15" -ThisBuild / crossScalaVersions := List("2.12.20", "2.13.15", "3.3.4", "3.5.1") +ThisBuild / crossScalaVersions := List("2.12.20", "2.13.15", "3.3.4", "3.5.2") ThisBuild / versionScheme := Some("semver-spec") ThisBuild / organization := "dev.profunktor" ThisBuild / homepage := Some(url("https://fs2-rabbit.profunktor.dev/"))