akka / alpakka

Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
https://doc.akka.io/docs/alpakka/current/
Other
1.26k stars 647 forks source link

Version 7.0.2 collides with AWS SQS SDK 2.25.14 #3158

Open jsarrelli opened 3 months ago

jsarrelli commented 3 months ago

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
ennru commented 3 months ago

Alpakka 7.0.2 depends on the AWS SDK 2.17.295 which is quite old now but we are conservative on this.

https://github.com/akka/alpakka/blob/a6676a146c5ce3ddc5b0b1e2cf183c9d37abe7c6/project/Dependencies.scala#L18

If you override the dependency to other versions the Alpakka team can not assist you. But thank you for letting us know that upgrading to the current versions might require more work.