alpakka icon indicating copy to clipboard operation
alpakka copied to clipboard

Version 7.0.2 collides with AWS SQS SDK 2.25.14

Open jsarrelli opened this issue 5 months ago • 1 comments

Hi guys,

I've realized there is an issue when the AWS SQS SDK on version "2.25.14" is present on the classpath, with version "2.20.69" it works just fine. I have a local SQS on a Docker container, which is why I am pointing to http://locahost:9324 and a queue called "awsSnapshot"

libraryDependencies +=  "software.amazon.awssdk" % "sqs" % "2.25.14",

val AkkaVersion = "2.9.0"
val AkkaHttpVersion = "10.6.0"
libraryDependencies ++= Seq(
  "com.lightbend.akka" %% "akka-stream-alpakka-sqs" % "7.0.2",
  "com.typesafe.akka" %% "akka-stream" % AkkaVersion,
  "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion
)

This code only tries to fetch the messages from the queue

object AlpakkaTests extends App {
  implicit val system: ActorSystem = ActorSystem("test")

  val logger = LoggerFactory.getLogger(this.getClass)

  implicit val sqsClient = SqsAsyncClient
    .builder
    .credentialsProvider(DefaultCredentialsProvider.create())
    .region(Region.US_EAST_1)
    .endpointOverride(URI.create("http://localhost:9324"))
    .httpClient(AkkaHttpClient.builder.withActorSystem(system).build)
    .build

  system.registerOnTermination(() => sqsClient.close())

  val sqsSource = SqsSourceSettings.create.withCloseOnEmptyReceive(true).withWaitTime(Duration.ofMillis(10))

  SqsSource("http://locahost:9324/queue/awsSnapshot", sqsSource)(sqsClient).runWith(Sink.seq[Message])
    .map(messages => logger.info(s"Got ${messages.size} messages"))
    .recover {
      case ex => logger.error("Boom", ex)
    }
}

With version "2.25.14" I got an error saying

software.amazon.awssdk.services.sqs.model.SqsException: Service returned HTTP status code 404 (Service: Sqs, Status Code: 404, Request ID: null)

Screenshot 2024-03-22 at 18 43 51

But with version "2.20.69" everything works fine

Screenshot 2024-03-22 at 18 49 59

jsarrelli avatar Mar 22 '24 21:03 jsarrelli