Project

skein

0.0
No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
Wrapper for RabbitMQ that makes blocking RPC calls and handles pub-sub broadcasts.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.2.0
 Project Readme

Skein

Skein is a RabbitMQ-based method for handling remote procedure calls (RPC) and pub/sub channels over AMQP using JSON-RPC payloads.

Dependencies

This library requires an active AMQP server like RabbitMQ and a Ruby driver for AMQP like Bunny or March Hare.

Both JRuby and MRI Ruby are supported with the appropriate driver.

Installation

The default Bundler configuration should be a good place to start:

bundle install

Configuration

For testing, set up config/rabbitmq.yml with configuration parameters that define how to connect to RabbitMQ.

Client Modes

RPC

An RPC client can make blocking or non-blocking calls. By default calls are blocking, but they can be made non-blocking by adding ! to the end of the method name. For example:

client = Skein::Client.rpc('test_queue')

client.request!(test: 'data')

client.close

Note that non-blocking calls are fire-and-forget, there is no way of knowing if that operation succeeded or failed.

Worker

The back-end that receives and processes RPC calls is instantiated as a Skein::Client::Worker instance:

class Responder < Skein::Client::Worker
  def request
    {
      result: true
    }
  end
end

Responder.new('test_queue')

Debugging

Setting the environment variable SKEIN_DEBUG_JSON will show raw JSON payloads received by both RPC workers and clients.