fs2-queues

AWS SQS

You can create a client to service bus queues by using the AWS SQS module.

libraryDependencies += "com.commercetools" %% "fs2-queues-aws-sqs" % "0.5.0"

For instance, you can create a managed client via a region and credentials as follows.

import cats.effect.IO
import com.commercetools.queue.aws.sqs._
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider

val region = Region.US_EAST_1 // your region
val credentials = DefaultCredentialsProvider.create() // however you want to authenticate

SQSClient[IO](region, credentials).use { client =>
  ???
}

The client is managed, meaning that it uses a dedicated HTTP connection pool that will get shut down upon resource release.

If integrating with an existing code base where you already have an instance of SdkAsyncHttpClient that you would like to share, you can pass the optional httpClient parameter. If passed explicitly, the client is not closed when the resource is released, and it is up to the caller to manage it.

For full customization, you can supply your own instance of SqsAsyncClient by using SQSClient.fromClient. Note that this requires explicit management of the underlying client's lifecycle.