diff --git a/.scalafmt.conf b/.scalafmt.conf index ed0a98a..a66ea0f 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,3 @@ runner.dialect = scala213 -version = "3.4.3" +version = "3.5.3" maxColumn = 120 \ No newline at end of file diff --git a/build.sbt b/build.sbt index a62ec1f..9371adc 100644 --- a/build.sbt +++ b/build.sbt @@ -1,10 +1,10 @@ //Core deps -val amazonV = "2.17.143" +val amazonV = "2.17.191" val catsV = "2.7.0" -val catsEffectV = "3.3.6" -val fs2V = "3.2.5" +val catsEffectV = "3.3.12" +val fs2V = "3.2.7" val log4catsV = "1.2.0" -val refinedV = "0.9.28" +val refinedV = "0.9.29" val collectionCompatV = "2.7.0" val catsCore = "org.typelevel" %% "cats-core" % catsV @@ -22,8 +22,8 @@ val collectionCompat = //Test/build deps val munitV = "0.7.29" val munitCatsEffectV = "1.0.7" -val scalaCheckV = "1.15.4" -val scalaCheckEffectV = "1.0.3" +val scalaCheckV = "1.16.0" +val scalaCheckEffectV = "1.0.4" val catsEffectLaws = "org.typelevel" %% "cats-effect-laws" % catsEffectV % "test" diff --git a/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedMessage.scala b/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedMessage.scala index 7f7fa61..b9c1e05 100644 --- a/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedMessage.scala +++ b/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedMessage.scala @@ -14,4 +14,4 @@ final case class RefinedMessageWithAttributes[F[_]]( receiptHandle: RefinedReceiptHandle[F], attributes: MessageAttributes ) extends BaseSqsMessage[F, VisibilityTimeout] - with WithAttributes \ No newline at end of file + with WithAttributes diff --git a/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedSqsClient.scala b/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedSqsClient.scala index e8320ca..32899f7 100644 --- a/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedSqsClient.scala +++ b/modules/sqs-refined/src/main/scala/com/rewardsnetwork/pureaws/sqs/refined/RefinedSqsClient.scala @@ -103,7 +103,8 @@ object RefinedSqsClient { queueUrl, settings.maxMessages.value, settings.visibilityTimeoutSeconds.value, - settings.waitTimeSeconds.value + settings.waitTimeSeconds.value, + receiveAttrs = true ) .map { m => val attributes = MessageAttributes.fromMap( @@ -134,13 +135,22 @@ object RefinedSqsClient { def sendMessage(queueUrl: String, messageBody: String): F[String] = simpleClient.sendMessage(queueUrl, messageBody) - def sendMessage(queueUrl: String, messageBody: String, messageAttributes: Map[String, MessageAttributeValue]): F[String] = + def sendMessage( + queueUrl: String, + messageBody: String, + messageAttributes: Map[String, MessageAttributeValue] + ): F[String] = simpleClient.sendMessage(queueUrl, messageBody, messageAttributes) def sendMessage(queueUrl: String, messageBody: String, delaySeconds: Int Refined DelaySeconds): F[String] = simpleClient.sendMessage(queueUrl, messageBody, delaySeconds.value) - def sendMessage(queueUrl: String, messageBody: String, delaySeconds: Int Refined DelaySeconds, messageAttributes: Map[String, MessageAttributeValue]): F[String] = + def sendMessage( + queueUrl: String, + messageBody: String, + delaySeconds: Int Refined DelaySeconds, + messageAttributes: Map[String, MessageAttributeValue] + ): F[String] = simpleClient.sendMessage(queueUrl, messageBody, delaySeconds.value, messageAttributes) } diff --git a/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/MessageAttributes.scala b/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/MessageAttributes.scala index f2eb432..d4cfda3 100644 --- a/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/MessageAttributes.scala +++ b/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/MessageAttributes.scala @@ -15,7 +15,10 @@ final case class MessageAttributes( ) object MessageAttributes { - def fromMap(m: Map[MessageSystemAttributeName, String], other: Map[String, MessageAttributeValue]): MessageAttributes = { + def fromMap( + m: Map[MessageSystemAttributeName, String], + other: Map[String, MessageAttributeValue] + ): MessageAttributes = { import MessageSystemAttributeName._ val approxReceiveCount = m.get(APPROXIMATE_RECEIVE_COUNT).flatMap(toIntOption) val approxFirstReceiveTimestamp = m.get(APPROXIMATE_FIRST_RECEIVE_TIMESTAMP).flatMap(toLongOption) diff --git a/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/SimpleSqsClient.scala b/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/SimpleSqsClient.scala index 96d141d..71f448d 100644 --- a/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/SimpleSqsClient.scala +++ b/modules/sqs/src/main/scala/com/rewardsnetwork/pureaws/sqs/SimpleSqsClient.scala @@ -4,6 +4,7 @@ import cats.syntax.all._ import cats.effect._ import fs2.Stream import software.amazon.awssdk.regions.Region +import software.amazon.awssdk.services.sqs.model.QueueAttributeName.ALL import software.amazon.awssdk.services.sqs.model._ import scala.jdk.CollectionConverters._ @@ -60,8 +61,8 @@ trait SimpleSqsClient[F[_]] { messageAttributes: Map[String, MessageAttributeValue] ): F[String] - /** Send a message to an SQS queue. Allows specifying the seconds to delay the message (valid values - * between 0 and 900). + /** Send a message to an SQS queue. Allows specifying the seconds to delay the message (valid values between 0 and + * 900). * @return * The message ID string of the sent message. */ @@ -71,7 +72,7 @@ trait SimpleSqsClient[F[_]] { delaySeconds: Int ): F[String] - /** Send a message with attributes to an SQS queue. Allows specifying the seconds to delay the message (valid values + /** Send a message with attributes to an SQS queue. Allows specifying the seconds to delay the message (valid values * between 0 and 900). * @return * The message ID string of the sent message. @@ -98,7 +99,7 @@ object SimpleSqsClient { .visibilityTimeout(visibilityTimeoutSeconds) .waitTimeSeconds(waitTimeSeconds) - val reqWithMaybeAttrs = (if (receiveAttrs) req.attributeNames(QueueAttributeName.ALL) else req).build + val reqWithMaybeAttrs = (if (receiveAttrs) req.attributeNames(ALL).messageAttributeNames(ALL.toString) else req).build client .receiveMessageStream(reqWithMaybeAttrs) @@ -180,7 +181,7 @@ object SimpleSqsClient { def sendMessage( queueUrl: String, messageBody: String, - delaySeconds: Int, + delaySeconds: Int ): F[String] = { sendMessage(queueUrl, messageBody, delaySeconds, Map.empty[String, MessageAttributeValue]) } diff --git a/project/plugins.sbt b/project/plugins.sbt index b76167e..4e4a22b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.22") +addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.3.1") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")