Project

redpack

0.01
No commit activity in last 3 years
No release in over 3 years
Simple Scalable RPC using Redis & BSON
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.1.4
>= 0.3.0
 Project Readme

RedPack - Easily Scalable RPC

Super simple RPC using a slightly modified form of MsgPack-RPC & BSON, on top of Redis queues. Currently supports NodeJS, Ruby, and Java.

NodeJS examples

npm install redpack

Server:

s = new rpc.Server('my_queue_name', {
  echo: function(amount) {
    return "from node server: " + (amount + 10);
  }
});
s.start();

Client:

c = new rpc.Client('my_queue_name');
c.invoke('echo', [12], function(err, result) {
  console.log("result is: "+result);
});

Ruby examples:

gem install redpack

Server:

class ExampleService
  def echo(amount)
    puts "called add_amount"
    return "from ruby: #{amount + 2}"
  end
end

server = RedPack::Server.new("my_queue_name", ExampleService.new)
server.start()

Client:

client = RedPack::Client.new("my_queue_name")

puts "making the method call asynchronously"
client.echo_async(23) do |error, result|
  puts "async result:"
  p result
end

Java examples:

Server:

public class EchoService implements Service {
  public Object execute(Object... params) throws ServiceException {
	  System.out.println("in echo");
    return "echo!";
  }
}

RPCServer server = new RPCServer("my_queue_name");
server.registerService("echo", new EchoService());
server.start();

Client:

RPCClient client = new RPCClient("my_queue_name");
Object result = client.invoke("echo", "something from java");
System.out.println("result : "+result.toString());