Code Monkey home page Code Monkey logo

toamqp's Introduction

Thrift over AMQP (toamqp)

DESCRIPTION

Transports thrift messages via an AMQP broker.

Advantages: (see also)

  • Less Network Load You don’t open as many TCP connections (one instead of one per service)
  • Simplicity One well known service point (your broker) instead of many IP/port pairs to know for clients
  • Persistence Messages wont get lost if you don’t want them to.
  • Safe IPC Since the AMQP broker implements a queue, you can avoid doing so on your end. No mucking around with Threads and Queues.

This library provides the glue code between thrift and bunny (AMQP client) and allows easy creation of a service.

SYNOPSIS

Using the following interface definition:


  service AwesomeService {
    // a little hommage 
    oneway void battleCry(1:string battlecry);
  }

Create a connection to your AMQP server:


  # Default is localhost, user guest, password guest. 
  TOAMQP.connection_manager.connection_attributes = {
    :host => 'mq.mydomain.com
  }

On the server (consumer of messages):


  class MyAwesomeService < TOAMQP::Service::Base
    exchange 'awesome_service'    # public name of the service
    serves AwesomeService         # Module generated by thrift
    
    def battleCry(message)
      puts messages
    end
  end
  
  TOAMQP.server(MyAwesomeService.new).serve--

On the client:


  client = TOAMQP.client('awesome_service', AwesomeService)
  
  client.battleCry('chunky bacon!')   # prints 'chunky bacon!' on the server

INSTALLATION

A development machine needs a fairly recent AMQP broker (should implement the headers binding type) and the full thrift install. You need the full install to be able to compile thrift service definitions.

To install this library, just type


  $ gem install toamqp

SPECIFICATION

To run the specs, just type


  $ rake specs

Integration tests need a AMQP broker to run on localhost. This has so far only been tested with RabbitMQ. (http://www.rabbitmq.com/)


  $ rake thrift
  $ rake

FEEDBACK

Issue tracker at: http://www.github.com/kschiess/toamqp

LICENSE

(The MIT License)

Copyright © 2009,2010 Kaspar Schiess

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.

toamqp's People

Contributors

kschiess avatar

Stargazers

Vlad avatar

Watchers

Vlad avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.