ElasticMQ is a simple message queue system, written entirely in Scala.
Currently messages are persisted in a database (by default an in-memory H2 instance) using Squeryl.
ElasticMQ implements a subset of the SQS REST interface, providing an SQS alternative e.g. for testing purposes.
The REST server is implemented using Netty, a high-performance, asynchronous, event-driven server Java framework.
The SQS interface has been tested using the Amazon Java SDK library;
see the rest-sqs-testing-amazon-java-sdk
module for the testsuite.
In the future... ElasticMQ may provide many more exciting features :).
// First we need to create a Node
val node = NodeBuilder.withInMemoryStorage().build()
// Then we can expose the native client using the SQS REST interface
val server = SQSRestServerFactory.start(node.nativeClient, 8888, "http://localhost:8888")
// ... use ...
// Finally we need to stop the server and the node
server.stop()
node.shutdown()
Alternatively, you can use MySQL to store the datea:
val node = NodeBuilder.withMySQLStorage("elasticmq", "root", "").build()
val elasticmqCore = "org.elasticmq" %% "core" % "0.2"
val elasticmqSqs = "org.elasticmq" %% "rest-sqs" % "0.2"
val smlResolver = "SotwareMill Public Releases" at "http://tools.softwaremill.pl/nexus/content/repositories/snapshots/"
Dependencies:
<dependency>
<groupId>org.elasticmq</groupId>
<artifactId>core_2.9.1</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>org.elasticmq</groupId>
<artifactId>rest-sqs_2.9.1</artifactId>
<version>0.2</version>
</dependency>
And our repository:
<repository>
<id>SotwareMillPublicReleases</id>
<name>SotwareMill Public Releases</name>
<url>http://tools.softwaremill.pl/nexus/content/repositories/snapshots/</url>
</repository>
Stable: 0.2
Development: 0.3-SNAPSHOT
The MySQL Schema can be found in core/src/main/resource/schema-mysql.sql
file. It should be easily adaptable to
other databases.