ElasticMQ 0.2 – 支持延遲隊列和消息
ElasticMQ 是一個使用 Scala 編寫的簡單消息隊列系統。當前使用嵌入式數據庫 H2 來存儲消息。ElasticMQ 實現了 SQS REST 接口的子集,提供一個 SQS 的可選方案。
ElasticMQ 0.2 最值得關注的就是支持延遲隊列和消息,另外實現了 Amazon SQS 接口。
// 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")// Now we need to create the sqs client client = new AmazonSQSClient(new BasicAWSCredentials("x", "x")) client.setEndpoint("http://localhost:8888")
// Using the client is quite straightforward val queueUrl = client.createQueue(new CreateQueueRequest("queue1")) .getQueueUrl client.sendMessage(new SendMessageRequest(queueUrl, "message1"))
client.shutdown()
// Finally we need to stop the server and the node server.stop() node.shutdown()</pre>
https://github.com/adamw/elasticmq本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!