forked from getmoto/moto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an example of using a moto server with Scala
- Loading branch information
MiazinNikita
authored and
MiazinNikita
committed
Jul 7, 2019
1 parent
af0205b
commit ea7ac6e
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.amazonaws.examples | ||
|
||
import com.amazonaws.client.builder.AwsClientBuilder | ||
import com.amazonaws.regions.{Region, Regions} | ||
import com.amazonaws.services.sqs.AmazonSQSClientBuilder | ||
|
||
import scala.jdk.CollectionConverters._ | ||
|
||
object QueueTest extends App { | ||
val region = Region.getRegion(Regions.US_WEST_2).getName | ||
val serviceEndpoint = "http://localhost:5000" | ||
|
||
val amazonSqs = AmazonSQSClientBuilder.standard() | ||
.withEndpointConfiguration( | ||
new AwsClientBuilder.EndpointConfiguration(serviceEndpoint, region)) | ||
.build | ||
|
||
val queueName = "my-first-queue" | ||
amazonSqs.createQueue(queueName) | ||
|
||
val urls = amazonSqs.listQueues().getQueueUrls.asScala | ||
println("Listing queues") | ||
println(urls.map(url => s" - $url").mkString(System.lineSeparator)) | ||
println() | ||
} |