probject

A lightweight actor-based concurrent object framework with each object running in it's own process.

How does it work?

Each new object will fork and open up two UNIX sockets, one for requests and one for responses. Each method invocation on the actor is really asynchronous, but one can wait for the method to return by reading from the response channel.

Example

require 'net/http'
require 'probject'

class GoogleRequester < Probject::Actor

  def do_request
    @response = Net::HTTP.get('www.google.com', '/')
  end

  def response_length
    @response.length
  end
end

probjects = []

1.upto 5 do |i|
  probjects[i] = GoogleRequester.new

  probjects[i].async.do_request
end

1.upto 5 do |i|
  puts probjects[i].response_length
end

Install

$ gem install probject

License

Released under the MIT License. See LICENSE.txt