Skip to content

Commit c632d4c

Browse files
authored
Move ElasticMQServer class to rest-sqs module (#1117)
* Move ElasticMQServer class to rest-sqs module * Update Readme
1 parent 02f076f commit c632d4c

File tree

10 files changed

+112
-126
lines changed

10 files changed

+112
-126
lines changed

README.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ aws {
114114
You can also provide an alternative [Logback](http://logback.qos.ch/) configuration file (the
115115
[default](server/src/main/resources/logback.xml) is configured to
116116
log INFO logs and above to the console):
117-
117+
118118
```
119119
java -Dlogback.configurationFile=my_logback.xml -jar elasticmq-server-$VERSION.jar
120120
```
@@ -241,12 +241,47 @@ On startup, any queues and their messages persisted in the database will be recr
241241
Note that the persisted queues take precedence over the queues defined
242242
in the main configuration file (as described in the previous section) in the `queues` section.
243243

244+
# ElasticMQ dependencies in SBT
245+
246+
```scala
247+
// Scala 2.13 and 2.12
248+
val elasticmqSqs = "org.elasticmq" %% "elasticmq-rest-sqs" % Version
249+
```
250+
251+
If you don't want the SQS interface, but just use the actors directly, you can add a dependency only to the `core`
252+
module:
253+
254+
```scala
255+
val elasticmqCore = "org.elasticmq" %% "elasticmq-core" % Version
256+
```
257+
258+
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.
259+
260+
# ElasticMQ dependencies in Maven
261+
262+
Dependencies:
263+
264+
```xml
265+
<dependency>
266+
<groupId>org.elasticmq</groupId>
267+
<artifactId>elasticmq-rest-sqs_2.12</artifactId>
268+
<version>${version}</version>
269+
</dependency>
270+
```
271+
272+
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.
273+
274+
# Logging
275+
276+
ElasticMQ uses [Slf4j](http://www.slf4j.org/) for logging. By default, no logger backend is included as a dependency,
277+
however [Logback](http://logback.qos.ch/) is recommended.
278+
244279
# Starting an embedded ElasticMQ server with an SQS interface
245280

246-
Add ElasticMQ Server to `build.sbt` dependencies
281+
Add ElasticMQ Rest SQS module to `build.sbt` dependencies
247282

248283
```scala
249-
libraryDependencies += "org.elasticmq" %% "elasticmq-server" % Version
284+
libraryDependencies += "org.elasticmq" %% "elasticmq-rest-sqs" % Version
250285
```
251286

252287
Simply start the server using custom configuration (see examples above):
@@ -435,41 +470,6 @@ ENTRYPOINT [ "/usr/bin/java", "-Dconfig.file=/opt/elasticmq/conf/elasticmq.conf"
435470

436471
and override the entrypoint passing the required properties.
437472

438-
# ElasticMQ dependencies in SBT
439-
440-
```scala
441-
// Scala 2.13 and 2.12
442-
val elasticmqSqs = "org.elasticmq" %% "elasticmq-rest-sqs" % Version
443-
```
444-
445-
If you don't want the SQS interface, but just use the actors directly, you can add a dependency only to the `core`
446-
module:
447-
448-
```scala
449-
val elasticmqCore = "org.elasticmq" %% "elasticmq-core" % Version
450-
```
451-
452-
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.
453-
454-
# ElasticMQ dependencies in Maven
455-
456-
Dependencies:
457-
458-
```xml
459-
<dependency>
460-
<groupId>org.elasticmq</groupId>
461-
<artifactId>elasticmq-rest-sqs_2.12</artifactId>
462-
<version>${version}</version>
463-
</dependency>
464-
```
465-
466-
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.
467-
468-
# Logging
469-
470-
ElasticMQ uses [Slf4j](http://www.slf4j.org/) for logging. By default no logger backend is included as a dependency,
471-
however [Logback](http://logback.qos.ch/) is recommended.
472-
473473
# Performance
474474

475475
Tests done on a 2012 MBP, 2.6GHz, 16GB RAM, no replication. Throughput is in messages per second (messages are

build.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ lazy val restSqs: Project = (project in file("rest/rest-sqs"))
195195
) ++ common
196196
)
197197
)
198-
.dependsOn(core % "compile->compile;test->test", commonTest % "test")
198+
.dependsOn(core % "compile->compile;test->test", persistenceFile, persistenceSql, commonTest % "test")
199199

200200
lazy val restSqsTestingAmazonJavaSdk: Project =
201201
(project in file("rest/rest-sqs-testing-amazon-java-sdk"))
@@ -230,8 +230,8 @@ lazy val server: Project = (project in file("server"))
230230
// s3 upload
231231
s3Upload := {
232232
import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
233-
import com.amazonaws.services.s3.AmazonS3ClientBuilder
234-
import com.amazonaws.services.s3.model.{CannedAccessControlList, PutObjectRequest}
233+
import com.amazonaws.services.s3.AmazonS3ClientBuilder
234+
import com.amazonaws.services.s3.model.{CannedAccessControlList, PutObjectRequest}
235235

236236
val bucketName = "softwaremill-public"
237237

@@ -278,7 +278,7 @@ lazy val server: Project = (project in file("server"))
278278
dockerExposedVolumes += "/data"
279279
)
280280
)
281-
.dependsOn(core, restSqs, persistenceFile, persistenceSql, commonTest % "test")
281+
.dependsOn(core, restSqs)
282282

283283
val graalVmVersion = "22.1.0"
284284
val graalVmTag = s"ol8-java11-$graalVmVersion"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
11
elasticmq {
22
debug = false
3+
}
4+
5+
# What is the outside visible address of this ElasticMQ node
6+
# Used to create the queue URL (may be different from bind address!)
7+
node-address {
8+
protocol = "http"
9+
host = "localhost"
10+
port = 9324
11+
context-path = ""
12+
}
13+
14+
rest-sqs {
15+
enabled = true
16+
bind-port = 9324
17+
bind-hostname = "0.0.0.0"
18+
# Possible values: relaxed, strict
19+
sqs-limits = strict
20+
}
21+
22+
rest-stats {
23+
enabled = true
24+
bind-port = 9325
25+
bind-hostname = "0.0.0.0"
26+
}
27+
28+
# Should the node-address be generated from the bind port/hostname
29+
# Set this to true e.g. when assigning port automatically by using port 0.
30+
generate-node-address = false
31+
32+
queues {
33+
# queueName1 {
34+
# // all optional
35+
# defaultVisibilityTimeout = 10 seconds
36+
# delay = 5 seconds
37+
# maxReceiveCount = 3
38+
# receiveMessageWait = 0 seconds
39+
# deadLettersQueue {
40+
# // all mandatory
41+
# name = "myDLQ"
42+
# maxReceiveCount = 3
43+
# }
44+
# copyTo = "audit-queue-name"
45+
# moveTo = "redirect-queue-name"
46+
# tags {
47+
# tag1 = "tagged1",
48+
# tag2 = "tagged2"
49+
# }
50+
# }
51+
}
52+
53+
queues-storage {
54+
enabled = false
55+
path = ""
56+
}
57+
58+
aws {
59+
region = "elasticmq"
60+
accountId = "000000000000"
61+
}
62+
63+
messages-storage {
64+
enabled = false
65+
driver-class = "org.h2.Driver"
66+
uri = "jdbc:h2:/data/elasticmq-h2"
67+
username = ""
68+
password = ""
69+
prune-data-on-init = false
370
}

server/src/main/scala/org/elasticmq/server/ElasticMQServer.scala renamed to rest/rest-sqs/src/main/scala/org/elasticmq/server/ElasticMQServer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import org.elasticmq.rest.stats.{StatisticsRestServer, TheStatisticsRestServerBu
1414
import org.elasticmq.server.config.ElasticMQServerConfig
1515
import org.elasticmq.util.{Logging, NowProvider}
1616

17-
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
18-
import scala.concurrent.duration._
1917
import scala.concurrent.duration.Duration.Inf
18+
import scala.concurrent.duration._
19+
import scala.concurrent.{Await, ExecutionContextExecutor, Future}
2020

2121
class ElasticMQServer(config: ElasticMQServerConfig) extends Logging {
2222
private val actorSystem = ActorSystem("elasticmq")

server/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala renamed to rest/rest-sqs/src/main/scala/org/elasticmq/server/config/ElasticMQServerConfig.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package org.elasticmq.server.config
22

33
import com.typesafe.config.Config
4-
import org.elasticmq.persistence.sql.SqlQueuePersistenceConfig
54
import org.elasticmq.persistence.CreateQueueMetadata
65
import org.elasticmq.persistence.file.QueueConfigUtil
6+
import org.elasticmq.persistence.sql.SqlQueuePersistenceConfig
77
import org.elasticmq.util.Logging
88
import org.elasticmq.{NodeAddress, RelaxedSQSLimits, StrictSQSLimits}
99

server/src/main/resources/reference.conf

Lines changed: 0 additions & 66 deletions
This file was deleted.

server/src/main/scala/org/elasticmq/server/config/DeadLettersQueue.scala

Lines changed: 0 additions & 3 deletions
This file was deleted.

server/src/test/scala/org/elasticmq/server/package.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)