ElasticMQ 0.3 just got released! ElasticMQ is a simple message queue system, which exposes both a native and an Amazon SQS-compatible interface. There are two major changes in this release.
Firstly, there’s a new all-Scala/Java in-memory message storage, significantly faster than the previous one, which simply used an in-memory H2 instance; currently the implementation is based on Java concurrent queues. The usage is still very simple, to create an ElasticMQ instance with in-memory storage just execute christmas inflatables canada:
val node = NodeBuilder.withInMemoryStorage().build()
val server = SQSRestServerFactory.start(node.nativeClient,
8888, "http://localhost:8888")
To show some numbers, here are a couple of runs of the MultiThreadPerformanceTest test on my MBP (2.4GHz Core2Duo, 8GB ram; all operations executed using the native API, without the http overhead):
Storage: InMemory, number of threads: 5, number of messages: 50000 Send took: 3 (3140), ops: 250000, ops per second: 83333 Receive took: 5 (5057), ops: 250000, ops per second: 50000 Storage: MySQL, number of threads: 5, number of messages: 2000 Send took: 5 (5500), ops: 10000, ops per second: 2000 Receive took: 74 (74269), ops: 10000, ops per second: 135 Storage: H2, number of threads: 5, number of messages: 2000 Send took: 0 (841), ops: 10000, ops per second: 10000 Receive took: 30 (30388), ops: 10000, ops per second: 333
I think the difference is pretty clear.
Secondly, the native API has seen a major rewrite. It has a much nicer, object-oriented feel, for example (all classes are thread-safe):
val node = NodeBuilder.withInMemoryStorage().build()
val client = node.nativeClient
val queue = client.createOrLookupQueue("queue1");
queue.sendMessage("msg1")
queue.sendMessage(MessageBuilder("msg2").withNextDelivery(tomorrow))
queue.receiveMessage().map(message => {
println(message.content)
message.delete()
})
See the Client, Queue, QueueOperations, Message and MessageOperations traits for details.
I also created a Google Group in case you have any questions, ideas or problems with ElasticMQ (feedback is very welcome!).
See the README for details on how to download and use ElasticMQ in your SBT/Maven project.
Adam
comments powered by Disqus