diff --git a/README.md b/README.md index f27614a34..509d42a1d 100644 --- a/README.md +++ b/README.md @@ -40,18 +40,18 @@ Installation: stand-alone ------------------------- You can download the stand-alone distribution here: -[https://s3/.../elasticmq-server-0.8.4.jar](https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.8.4.jar) +[https://s3/.../elasticmq-server-0.8.5.jar](https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-0.8.5.jar) Java 6 or above is required for running the server. Simply run the jar and you should get a working server, which binds to `localhost:9324`: - java -jar elasticmq-server-0.8.4.jar + java -jar elasticmq-server-0.8.5.jar ElasticMQ uses [Typesafe Config](https://github.com/typesafehub/config) for configuration. To specify custom configuration values, create a file (e.g. `custom.conf`), fill it in with the desired values, and pass it to the server: - java -Dconfig.file=custom.conf -jar elasticmq-server-0.8.4.jar + java -Dconfig.file=custom.conf -jar elasticmq-server-0.8.5.jar The config file may contain any configuration for Akka, Spray and ElasticMQ. Current ElasticMQ configuration values are: @@ -83,7 +83,7 @@ You can also provide an alternative [Logback](http://logback.qos.ch/) configurat [default](server/src/main/resources/logback.xml) is configured to log INFO logs and above to the console): - java -Dlogback.configurationFile=my_logback.xml -jar elasticmq-server-0.8.4.jar + java -Dlogback.configurationFile=my_logback.xml -jar elasticmq-server-0.8.5.jar Starting an embedded ElasticMQ server with an SQS interface ----------------------------------------------------------- @@ -116,22 +116,11 @@ The endpoint value should be the same address as the `NodeAddress` provided as a The `rest-sqs-testing-amazon-java-sdk` module contains some more usage examples. -Custom extensions ------------------ - -ElasticMQ implements one additional endpoint, which can be useful during testing, above what is supported by SQS. - -Making a request to: - - [queue url]?Action=Clear - -will remove all messages (both visibile and invisible) from the queue. - ElasticMQ dependencies in SBT ----------------------------- // Scala 2.11 - val elasticmqSqs = "org.elasticmq" %% "elasticmq-rest-sqs" % "0.8.4" + val elasticmqSqs = "org.elasticmq" %% "elasticmq-rest-sqs" % "0.8.5" // Scala 2.10 val elasticmqSqs = "org.elasticmq" %% "elasticmq-rest-sqs" % "0.7.1" @@ -139,7 +128,7 @@ ElasticMQ dependencies in SBT If you don't want the SQS interface, but just use the actors directly, you can add a dependency only to the `core` module: - val elasticmqCore = "org.elasticmq" %% "elasticmq-core" % "0.8.4" + val elasticmqCore = "org.elasticmq" %% "elasticmq-core" % "0.8.5" If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration. @@ -151,7 +140,7 @@ Dependencies: org.elasticmq elasticmq-rest-sqs_2.11 - 0.8.4 + 0.8.5 If you want to use a snapshot version, you will need to add the [https://oss.sonatype.org/content/repositories/snapshots/](https://oss.sonatype.org/content/repositories/snapshots/) repository to your configuration. @@ -165,9 +154,9 @@ have not yet been reimplemented using the new Akka core. Current versions ---------------- -*Stable*: 0.8.4 +*Stable*: 0.8.5 -*Development*: 0.8.5-SNAPSHOT +*Development*: 0.8.6-SNAPSHOT Logging ------- @@ -216,6 +205,10 @@ Technology Change log ---------- +#### Version 0.8.5 (11 Dec 2014) + +* supporting `PurgeQueue` action instead of a custom one + #### Version 0.8.4 (2 Dec 2014) * custom action for clearing all messages from a queue diff --git a/project/Build.scala b/project/Build.scala index 9085e5245..110b2fc0c 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -6,7 +6,7 @@ import AssemblyKeys._ object BuildSettings { val buildSettings = Defaults.coreDefaultSettings ++ Seq ( organization := "org.elasticmq", - version := "0.8.5-SNAPSHOT", + version := "0.8.5", scalaVersion := "2.11.4", addCompilerPlugin("org.scala-lang.plugins" % "scala-continuations-plugin_2.11.0" % "1.0.1"), @@ -58,7 +58,7 @@ object Dependencies { val mockito = "org.mockito" % "mockito-core" % "1.9.5" val awaitility = "com.jayway.awaitility" % "awaitility-scala" % "1.6.0" - val amazonJavaSdk = "com.amazonaws" % "aws-java-sdk" % "1.9.1" exclude ("commons-logging", "commons-logging") + val amazonJavaSdk = "com.amazonaws" % "aws-java-sdk" % "1.9.10" exclude ("commons-logging", "commons-logging") val akka2Version = "2.3.6" val akka2Actor = "com.typesafe.akka" %% "akka-actor" % akka2Version diff --git a/rest/rest-sqs-testing-amazon-java-sdk/src/test/scala/org/elasticmq/rest/sqs/AmazonJavaSdkTestSuite.scala b/rest/rest-sqs-testing-amazon-java-sdk/src/test/scala/org/elasticmq/rest/sqs/AmazonJavaSdkTestSuite.scala index 16808eba7..423ab26d8 100644 --- a/rest/rest-sqs-testing-amazon-java-sdk/src/test/scala/org/elasticmq/rest/sqs/AmazonJavaSdkTestSuite.scala +++ b/rest/rest-sqs-testing-amazon-java-sdk/src/test/scala/org/elasticmq/rest/sqs/AmazonJavaSdkTestSuite.scala @@ -764,6 +764,24 @@ class AmazonJavaSdkTestSuite extends FunSuite with MustMatchers with BeforeAndAf result.isLeft must be (true) } + test("should purge the queue") { + // Given + val queueUrl = client.createQueue(new CreateQueueRequest("testQueue1")).getQueueUrl + + client.sendMessage(new SendMessageRequest(queueUrl, "Message 1")) + client.sendMessage(new SendMessageRequest(queueUrl, "Message 2")) + client.receiveMessage(new ReceiveMessageRequest(queueUrl).withMaxNumberOfMessages(1)).getMessages.get(0) + + // When + client.purgeQueue(new PurgeQueueRequest().withQueueUrl(queueUrl)) + + // Then + val attributes = client.getQueueAttributes(new GetQueueAttributesRequest(queueUrl).withAttributeNames("All")).getAttributes + attributes.get("ApproximateNumberOfMessages") must be ("0") + attributes.get("ApproximateNumberOfMessagesNotVisible") must be ("0") + attributes.get("ApproximateNumberOfMessagesDelayed") must be ("0") + } + def queueVisibilityTimeout(queueUrl: String) = getQueueLongAttribute(queueUrl, visibilityTimeoutAttribute) def queueDelay(queueUrl: String) = getQueueLongAttribute(queueUrl, delaySecondsAttribute) diff --git a/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/NonSQSDirectives.scala b/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/PurgeQueueDirectives.scala similarity index 66% rename from rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/NonSQSDirectives.scala rename to rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/PurgeQueueDirectives.scala index 0fd7a3ab2..a82b2a787 100644 --- a/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/NonSQSDirectives.scala +++ b/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/PurgeQueueDirectives.scala @@ -5,19 +5,19 @@ import org.elasticmq.msg.ClearQueue import org.elasticmq.rest.sqs.Constants._ import org.elasticmq.rest.sqs.directives.ElasticMQDirectives -trait NonSQSDirectives { this: ElasticMQDirectives with QueueURLModule => - val nonSQSDirectives = { - queueActorFromRequest { queueActor => - action("Clear") { +trait PurgeQueueDirectives { this: ElasticMQDirectives with QueueURLModule => + val purgeQueue = { + action("PurgeQueue") { + queueActorFromRequest { queueActor => for { _ <- queueActor ? ClearQueue() } yield { respondWith { - + {EmptyRequestId} - + } } } diff --git a/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala b/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala index 04ce162a7..ab95ab135 100644 --- a/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala +++ b/rest/rest-sqs/src/main/scala/org/elasticmq/rest/sqs/SQSRestServerBuilder.scala @@ -103,7 +103,7 @@ case class TheSQSRestServerBuilder(providedActorSystem: Option[ActorSystem], with ChangeMessageVisibilityDirectives with ChangeMessageVisibilityBatchDirectives with GetQueueUrlDirectives - with NonSQSDirectives + with PurgeQueueDirectives with AttributesModule { lazy val actorSystem = theActorSystem @@ -125,14 +125,13 @@ case class TheSQSRestServerBuilder(providedActorSystem: Option[ActorSystem], getQueueUrl ~ createQueue ~ listQueues ~ + purgeQueue ~ // 3. Other changeMessageVisibility ~ changeMessageVisibilityBatch ~ deleteQueue ~ getQueueAttributes ~ - setQueueAttributes ~ - // 4. Non-SQS - nonSQSDirectives + setQueueAttributes val config = new ElasticMQConfig