Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kennethkalmer/ratpack

Simple HTTP to XMPP/AMQP bridge built on Sinatra
https://github.com/kennethkalmer/ratpack

Last synced: about 15 hours ago
JSON representation

Simple HTTP to XMPP/AMQP bridge built on Sinatra

Awesome Lists containing this project

README

        

= ratpack

* http://github.com/kennethkalmer/ratpack

== DESCRIPTION:

Ratpack is a small Sinatra-based HTTP to XMPP/AMQP/SMTP bridge,
allowing you to send messages in a RESTful fashion. XMPP messages can
be sent to a pool of contacts in broadcast or round-robin mode, or
individually. AMQP messages are sent into the queue of choice.

I'm aware of BOSH[http://en.wikipedia.org/wiki/BOSH], but I'm not sure
if this will compete against it since BOSH should be for publicly
accessible resource that need to scale (It is an XEP by the way). For
AMQP there a fuller implementation called RestMS[http://www.restms.org].

Ratpack is meant to be used where XMPP/AMQP/SMTP forms part of the
backend processing environments, like bots that perform rankings or
crawl sites or whatever impractical use you can think of :)

== FEATURES/PROBLEMS:

XMPP

* Send messages asynchronously to individual contacts
* Send messages asynchronously to groups of contacts (broadcast & round-robin)
* Send messages synchronously to individual contacts, blocking for response
* Read incoming messages [Eventually]

AMQP

* Send messages asynchronously to named queues

SMTP

* Send a message directly to a specified recipient

* Performance is slow, expected for POC

== TODO:

* Switch to rack-mount
* Implement loudmouth-ruby for XMPP
* Speed this baby up, gonna need some help here
* Write tests
* Authentication and rate limiting
* Consolidate responses

== SYNOPSIS:

GET /
POST /xmpp/message with to & message where to is valid JID
POST /xmpp/broadcast with recipients[] & message where recipientsp[] valid JID's
POST /xmpp/pool with pool & message where pool is in config/pools.yml
POST /amqp/[queue] where queue is the name of the queue to send to and message is the message
POST /smtp with to, subject & body being the parameters

Here are some examples with curl for sending XMPP messages

$ curl -F to=kenneth@devbox -F message=test http://localhost:4567/xmpp/message
$ curl -F recipients[]=kenneth@devbox -F recipients[]=kenneth@devbox -F message=test3 http://localhost:4567/xmpp/broadcast
$ curl -F pool=sample -F message=test_pool http://localhost:4567/xmpp/pool

Here is one example for sending AMQP messages

$ ruby amqp/consumer.rb
... in another console ...
$ curl -F message=test http://localhost:4567/amqp/queue

And for sending emails

$ curl -F to=kenneth@devbox -F body=Test -F subject=ratpack http://localhost:4567/smtp

== REQUIREMENTS:

* activesupport
* sinatra (0.9.1.1)
* xmpp4r-simple (0.8.8)
* amqp (0.6.0)

Note: ratpack attempts to load the github sinatra gem first, and will
silently fail, using the standard sinatra gem installed on your system

== INSTALL:

$ git clone git://github.com/kennethkalmer/ratpack.git
... review config in config/ratpack.yml ...
$ ruby ratpack-app

== LICENSE:

(The MIT License)

Copyright (c) 2009 Kenneth Kalmer

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.