Skip to content

Instantly share code, notes, and snippets.

@ghostdogpr
Created July 21, 2019 08:17
Show Gist options
  • Save ghostdogpr/5a380c8ccca76cbf7c2ac4cfe4f83d50 to your computer and use it in GitHub Desktop.
Save ghostdogpr/5a380c8ccca76cbf7c2ac4cfe4f83d50 to your computer and use it in GitHub Desktop.
def send(client: SqsAsyncClient, queueUrl: String, msg: String): Task[Unit] =
IO.effectAsync[Any, Throwable, Unit] { cb =>
client
.sendMessage(SendMessageRequest.builder.queueUrl(queueUrl).messageBody(msg).build)
.handle[Unit]((_, err) => {
err match {
case null => cb(IO.unit)
case ex => cb(IO.fail(ex))
}
})
()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment