InfoQ

News

Reliable Messaging in Ruby with AP4R

Posted by Sebastien Auvray on Jun 18, 2007

Community
Ruby
Topics
Messaging
Tags
JMS ,
DRb ,
Ruby on Rails
Shun'ichi Shinohara and Kiwamu Kato have been  working on bringing reliable messging to Ruby with their own API & protocol project, based on previous experiences designing a Java-based high volume messaging framework.   AP4R, Asynchronous Processing for Ruby, is an implementation of reliable asynchronous message processing, providing message queuing and message dispatching.  Shun'ichi and Kiwamu gave a presentation at RubyKaigi 2007(pdf slides) about their API emphasizing it's key design philosophies: Robustness and Lightweight.

The project is just a year old, and already supports:
  1. Business logic can be implemented as simple Web apps or ruby code, whether it's called asynchronously or synchronously.
  2. RBMS (MySQL) or file-based message persistance
  3. Load balancing over multiple AP4R processes on single/multiple server(s) is supported.
  4. Multiple protocol support: XML-RPC, SOAP, HTTP POST, and more.
Shun'ichi and Kiwamu had previously implemented their own Java-based API and protocol (called RtFA), which was used in a large app with 100 servers processing over 100 million messages a day. Shun'ichi and Kiwamu claim to have improved upon their previous work with AP4R, while also focusing on on the ease of use. AP4R comes with a comprehensive documentation.

Integrated into rails, a typical process flow for using AP4R is:
  1. A client(e.g. a web browser) makes a request to a web server (Apache, Lighttpd, etc...).
  2. A rails application is synchronously executed on mongrel via mod_proxy or something.
  3. Rails app sends a message via AP4R APIs and can then immediatley respond to the client.
  4. AP4R queues the message and requests it to the web server asynchronously.
  5. The asynchronous business logic, implemented as usual rails action, is executed.
The focus for 0.3.x was Daemonization, URL-rewrite filter, DLQ / SAF recovery, and support for Stomp and HTTP has underlying protocols. Future versions will include support for Monitoring & management (e.g. thread status, web frontend), Coordination with Cacti, Nagios, etc, multi-process, Dynamic configurability, Automatic recovery, Blocking queues, and more.
Very cool by Andrew Kuklewicz Posted Jun 19, 2007 10:54 AM
  1. Back to top

    Very cool

    Jun 19, 2007 10:54 AM by Andrew Kuklewicz

    kudos to the ap4r folks, great to see this project coming along.

    Nice to see more messaging interest in rails - and the reliable messaging ruby lib + drb is a great way to get something going using good existing solutions.

    For an alternative, folks might also want to look at activemessaging
    Here's an intro on infoq about it

    Cheers,
    Andrew Kuklewicz

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.