简单消息队列系统 ElasticMQ

openkk 13年前
     <p>ElasticMQ 是一个使用 Scala 编写的简单消息队列系统。当前使用嵌入式数据库 H2 来存储消息。ElasticMQ 实现了 SQS REST 接口的子集,提供一个 SQS 的可选方案。ElasticMQ 使用 Squeryl 来访问数据库。<br /> <br /> <a href="/misc/goto?guid=4958184790217611369" target="_blank">squeryl</a>是一个ORM和DSL框架,可以通过它用最有效和最安全的方式和数据库打交道,让你从此告别访问数据库的烦恼和冗余代码,写SQL像写Scala一样简单搞笑(高效)。 </p>    <p>看看它的特性:</p>    <ul>     <li>能够让编译器帮你检查数据库访问的代码。通过编译的Squeryl代码不会在运行时出错。当编译出错的时候,能够告诉你哪儿错了。从此可以不用头疼SQL的无厘头报错方式了。</li>     <li>让你像编写SQL那样编写你的数据库访问,但是不用再和那些麻烦的底层API打交道了。</li>     <li>Squeryl语句的组合功能能够让你一次编写到处使用,减少代码的复杂度</li>     <li><br /> </li>    </ul>    <p></p>    <p>示例代码:</p>    <pre class="brush:scala; toolbar: true; auto-links: false;">// First we need to create a Node  val node = NodeBuilder.createNode  // 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()</pre>项目地址:    <a href="/misc/goto?guid=4958184790970779649" target="_blank">https://github.com/adamw/elasticmq</a>    <p></p>