README.md in acfs-0.16.0 vs README.md in acfs-0.17.0

- old
+ new

@@ -1,8 +1,13 @@ # Acfs - *API client for services* -[![Gem Version](https://badge.fury.io/rb/acfs.png)](http://badge.fury.io/rb/acfs) [![Build Status](https://travis-ci.org/jgraichen/acfs.png?branch=master)](https://travis-ci.org/jgraichen/acfs) [![Coverage Status](https://coveralls.io/repos/jgraichen/acfs/badge.png?branch=master)](https://coveralls.io/r/jgraichen/acfs) [![Code Climate](https://codeclimate.com/github/jgraichen/acfs.png)](https://codeclimate.com/github/jgraichen/acfs) [![Dependency Status](https://gemnasium.com/jgraichen/acfs.png)](https://gemnasium.com/jgraichen/acfs) +[![Gem Version](https://badge.fury.io/rb/acfs.png)](http://badge.fury.io/rb/acfs) +[![Build Status](https://travis-ci.org/jgraichen/acfs.png?branch=master)](https://travis-ci.org/jgraichen/acfs) +[![Coverage Status](https://coveralls.io/repos/jgraichen/acfs/badge.png?branch=master)](https://coveralls.io/r/jgraichen/acfs) +[![Code Climate](https://codeclimate.com/github/jgraichen/acfs.png)](https://codeclimate.com/github/jgraichen/acfs) +[![Dependency Status](https://gemnasium.com/jgraichen/acfs.png)](https://gemnasium.com/jgraichen/acfs) +[![RubyDoc Documentation](https://raw.github.com/jgraichen/acfs/master/rubydoc.png)](http://rubydoc.info/github/jgraichen/acfs/master/frames) Acfs is a library to develop API client libraries for single services within a larger service oriented application. Acfs covers model and service abstraction, convenient query and filter methods, full middleware stack for pre-processing requests and responses on a per service level and automatic request queuing and parallel processing. See Usage for more. @@ -14,15 +19,15 @@ **Note:** Acfs is under development. I'll try to avoid changes to the public API but internal APIs may change quite often. And then execute: - $ bundle + > bundle Or install it yourself as: - $ gem install acfs + > gem install acfs ## Usage First you need to define your service(s): @@ -183,10 +188,42 @@ Acfs.run # Would have raised Acfs::RealRequestNotAllowedError # Will run real request to user service instead. end ``` +## Messaging (Experimental) + +Acfs 0.17.0 includes experimental messaging support using RabbitMQ. You can create receivers for messages as well as send custom messages. Messages can be high level structures (like hashes) and will be packed into MessagePack. + +Create your custom receivers e.g. in `app/receivers`: + +```ruby +# app/receivers/my_receiver.rb + +class MyReceiver + include Acfs::Messaging::Receiver + route "my.#" # Specify routing key for receiving messages + + def receive(delivery_info, metadata, payload) + puts payload.inspect + # more foo... + end +end +``` + +Make sure the receivers get loaded by placing an initializer in you app that require all receivers. You need to do this manually but it will be automated in some future release. + +You can now send messages by calling the `publish` method directly: + +```ruby +Acfs::Messaging::Client.instance.publish "my.message", { message: "Hi!" } +``` + +This will invoke `#receive` on an instance of your receiver class. + +Be aware that messaging is still experimental and *will* change in future releases. + ## Roadmap * Update * Better new? detection eg. storing ETag from request resources. * Use PATCH for with only changed attributes and `If-Unmodifed-Since` @@ -199,9 +236,12 @@ * Reusing model definitions for generating responses? * Rails responders providing REST operations with integrated ETag, Modified Headers, conflict detection, ... * Pagination? Filtering? (If service API provides such features.) * Messaging Queue support for services and models + * Allow triggering messages on resource events (CRUD) + * Abstract messages into objects + * Middleware stack for messages? * Documentation ## Contributing 1. Fork it