Git Product home page Git Product logo

msgpack-rpc's Introduction

MessagePack

Extremely efficient object serialization library. It's like JSON, but very fast and small.

What's MessagePack?

MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.

Typical small integer (like flags or error code) is saved only in 1 byte, and typical short string only needs 1 byte except the length of the string itself. [1,2,3] (3 elements array) is serialized in 4 bytes using MessagePack as follows:

require 'msgpack'
msg = [1,2,3].to_msgpack  #=> "\x93\x01\x02\x03"
MessagePack.unpack(msg)   #=> [1,2,3]

MessagePack-RPC is cross-language RPC library for client, server and cluster applications. Because it releases you from complicated network programming completely and provides well-designed API, you can easily implement advanced network applications with MessagePack-RPC.

require 'msgpack/rpc'
class MyHandler
  def add(x,y) return x+y end
end
svr = MessagePack::RPC::Server.new
svr.listen('0.0.0.0', 18800, MyHandler.new)
svr.run

require 'msgpack/rpc'
c = MessagePack::RPC::Client.new('127.0.0.1',18800)
result = c.call(:add, 1, 2)  #=> 3

Getting Started

Usage and other documents about implementations in each language are found at the web site.

Implementations

Learn More

msgpack-rpc's People

Contributors

dgryski avatar ericliang avatar filmor avatar frsyuki avatar kuenishi avatar kzk avatar methane avatar moriyoshi avatar muga avatar nobu-k avatar normanmaurer avatar rboulton avatar repeatedly avatar s1monw avatar sugi avatar tanakh avatar voluntas avatar yanick avatar yuuna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msgpack-rpc's Issues

java.lang.ClassNotFoundException: org.msgpack.template.Template

Hi, I develop Jenkins plugin using msgpack. But in this time, an error has been occured in msgpack. Below debug log is printed when I do mvn hpi:run. When I do mvn package, unit test code using msgpack runs normally.

INFO: Jenkins is fully up and running
Nov 24, 2013 11:08:22 PM hudson.model.Run execute
INFO: Test.COMMIT #25 main build action completed: SUCCESS
Nov 24, 2013 11:08:23 PM org.msgpack.template.builder.BuildContext build
SEVERE: builder: 
{
  if (!$3 && $1.trySkipNil()) {
    return null;
  }
  us.jubat.classifier.EstimateResult _$$_t;
  if ($2 == null) {
    _$$_t = new us.jubat.classifier.EstimateResult();
  } else {
    _$$_t = (us.jubat.classifier.EstimateResult) $2;
  }
  $1.readArrayBegin();
  if ($1.trySkipNil()) {  } else {
    _$$_t.label = (java.lang.String) this.templates[0].read($1, _$$_t.label);
  }
    _$$_t.score = $1.readDouble();
  $1.readArrayEnd();
  return _$$_t;
}

org.msgpack.MessageTypeException: org.msgpack.template.builder.TemplateBuildException: Cannot compile: 
{
  if (!$3 && $1.trySkipNil()) {
    return null;
  }
  us.jubat.classifier.EstimateResult _$$_t;
  if ($2 == null) {
    _$$_t = new us.jubat.classifier.EstimateResult();
  } else {
    _$$_t = (us.jubat.classifier.EstimateResult) $2;
  }
  $1.readArrayBegin();
  if ($1.trySkipNil()) {  } else {
    _$$_t.label = (java.lang.String) this.templates[0].read($1, _$$_t.label);
  }
    _$$_t.score = $1.readDouble();
  $1.readArrayEnd();
  return _$$_t;
}

    at org.msgpack.template.TemplateRegistry.buildAndRegister(TemplateRegistry.java:516)
    at org.msgpack.template.TemplateRegistry.lookupAfterBuilding(TemplateRegistry.java:413)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:246)
    at org.msgpack.template.TemplateRegistry.lookupGenericTypeImpl(TemplateRegistry.java:302)
    at org.msgpack.template.TemplateRegistry.lookupGenericType(TemplateRegistry.java:275)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:201)
    at org.msgpack.template.TemplateRegistry.lookupGenericTypeImpl(TemplateRegistry.java:302)
    at org.msgpack.template.TemplateRegistry.lookupGenericType(TemplateRegistry.java:275)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:201)
    at org.msgpack.MessagePack.lookup(MessagePack.java:624)
    at org.msgpack.rpc.reflect.ReflectionProxyBuilder.buildProxy(ReflectionProxyBuilder.java:156)
    at org.msgpack.rpc.reflect.ProxyBuilder.buildProxy(ProxyBuilder.java:72)
    at org.msgpack.rpc.reflect.Reflect.getProxy(Reflect.java:57)
    at org.msgpack.rpc.Session.proxy(Session.java:61)
    at us.jubat.common.ClientBase.<init>(ClientBase.java:33)
    at us.jubat.classifier.ClassifierClient.<init>(ClassifierClient.java:18)
    at com.lewuathe.plugins.jenkinsjubatus.JubatusClient.<init>(JubatusClient.java:22)
    at com.lewuathe.plugins.jenkinsjubatus.JubatusResultPublisher.perform(JubatusResultPublisher.java:51)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
    at hudson.model.Run.execute(Run.java:1617)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:237)
Caused by: org.msgpack.template.builder.TemplateBuildException: Cannot compile: 
{
  if (!$3 && $1.trySkipNil()) {
    return null;
  }
  us.jubat.classifier.EstimateResult _$$_t;
  if ($2 == null) {
    _$$_t = new us.jubat.classifier.EstimateResult();
  } else {
    _$$_t = (us.jubat.classifier.EstimateResult) $2;
  }
  $1.readArrayBegin();
  if ($1.trySkipNil()) {  } else {
    _$$_t.label = (java.lang.String) this.templates[0].read($1, _$$_t.label);
  }
    _$$_t.score = $1.readDouble();
  $1.readArrayEnd();
  return _$$_t;
}

    at org.msgpack.template.builder.BuildContext.build(BuildContext.java:73)
    at org.msgpack.template.builder.DefaultBuildContext.buildTemplate(DefaultBuildContext.java:56)
    at org.msgpack.template.builder.JavassistTemplateBuilder.buildTemplate(JavassistTemplateBuilder.java:118)
    at org.msgpack.template.builder.AbstractTemplateBuilder.buildTemplate(AbstractTemplateBuilder.java:61)
    at org.msgpack.template.TemplateRegistry.buildAndRegister(TemplateRegistry.java:503)
    ... 26 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/msgpack/template/Template
    at javassist.ClassPool.toClass(ClassPool.java:1099)
    at javassist.CtClass.toClass(CtClass.java:1181)
    at org.msgpack.template.builder.BuildContext.createClass(BuildContext.java:154)
    at org.msgpack.template.builder.BuildContext.build(BuildContext.java:68)
    ... 30 more
Caused by: java.lang.NoClassDefFoundError: org/msgpack/template/Template
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javassist.ClassPool.toClass2(ClassPool.java:1112)
    at javassist.ClassPool.toClass(ClassPool.java:1093)
    ... 33 more
Caused by: java.lang.ClassNotFoundException: org.msgpack.template.Template
    at org.jenkinsci.maven.plugins.hpi.ServletApiOnlyClassLoader.findClass(ServletApiOnlyClassLoader.java:25)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
    ... 42 more
org.msgpack.MessageTypeException: org.msgpack.template.builder.TemplateBuildException: Cannot compile: 
{
  if (!$3 && $1.trySkipNil()) {
    return null;
  }
  us.jubat.classifier.EstimateResult _$$_t;
  if ($2 == null) {
    _$$_t = new us.jubat.classifier.EstimateResult();
  } else {
    _$$_t = (us.jubat.classifier.EstimateResult) $2;
  }
  $1.readArrayBegin();
  if ($1.trySkipNil()) {  } else {
    _$$_t.label = (java.lang.String) this.templates[0].read($1, _$$_t.label);
  }
    _$$_t.score = $1.readDouble();
  $1.readArrayEnd();
  return _$$_t;
}

    at org.msgpack.template.TemplateRegistry.buildAndRegister(TemplateRegistry.java:516)
    at org.msgpack.template.TemplateRegistry.lookupAfterBuilding(TemplateRegistry.java:413)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:246)
    at org.msgpack.template.TemplateRegistry.lookupGenericTypeImpl(TemplateRegistry.java:302)
    at org.msgpack.template.TemplateRegistry.lookupGenericType(TemplateRegistry.java:275)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:201)
    at org.msgpack.template.TemplateRegistry.lookupGenericTypeImpl(TemplateRegistry.java:302)
    at org.msgpack.template.TemplateRegistry.lookupGenericType(TemplateRegistry.java:275)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:201)
    at org.msgpack.MessagePack.lookup(MessagePack.java:624)
    at org.msgpack.rpc.reflect.ReflectionProxyBuilder.buildProxy(ReflectionProxyBuilder.java:156)
    at org.msgpack.rpc.reflect.ProxyBuilder.buildProxy(ProxyBuilder.java:72)
    at org.msgpack.rpc.reflect.Reflect.getProxy(Reflect.java:57)
    at org.msgpack.rpc.Session.proxy(Session.java:61)
    at us.jubat.common.ClientBase.<init>(ClientBase.java:33)
    at us.jubat.classifier.ClassifierClient.<init>(ClassifierClient.java:18)
    at com.lewuathe.plugins.jenkinsjubatus.JubatusClient.<init>(JubatusClient.java:22)
    at com.lewuathe.plugins.jenkinsjubatus.JubatusResultPublisher.perform(JubatusResultPublisher.java:51)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:780)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:752)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
    at hudson.model.Run.execute(Run.java:1617)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:237)
Caused by: org.msgpack.template.builder.TemplateBuildException: Cannot compile: 
{
  if (!$3 && $1.trySkipNil()) {
    return null;
  }
  us.jubat.classifier.EstimateResult _$$_t;
  if ($2 == null) {
    _$$_t = new us.jubat.classifier.EstimateResult();
  } else {
    _$$_t = (us.jubat.classifier.EstimateResult) $2;
  }
  $1.readArrayBegin();
  if ($1.trySkipNil()) {  } else {
    _$$_t.label = (java.lang.String) this.templates[0].read($1, _$$_t.label);
  }
    _$$_t.score = $1.readDouble();
  $1.readArrayEnd();
  return _$$_t;
}

    at org.msgpack.template.builder.BuildContext.build(BuildContext.java:73)
    at org.msgpack.template.builder.DefaultBuildContext.buildTemplate(DefaultBuildContext.java:56)
    at org.msgpack.template.builder.JavassistTemplateBuilder.buildTemplate(JavassistTemplateBuilder.java:118)
    at org.msgpack.template.builder.AbstractTemplateBuilder.buildTemplate(AbstractTemplateBuilder.java:61)
    at org.msgpack.template.TemplateRegistry.buildAndRegister(TemplateRegistry.java:503)
    ... 26 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/msgpack/template/Template
    at javassist.ClassPool.toClass(ClassPool.java:1099)
    at javassist.CtClass.toClass(CtClass.java:1181)
    at org.msgpack.template.builder.BuildContext.createClass(BuildContext.java:154)
    at org.msgpack.template.builder.BuildContext.build(BuildContext.java:68)
    ... 30 more
Caused by: java.lang.NoClassDefFoundError: org/msgpack/template/Template
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at javassist.ClassPool.toClass2(ClassPool.java:1112)
    at javassist.ClassPool.toClass(ClassPool.java:1093)
    ... 33 more
Caused by: java.lang.ClassNotFoundException: org.msgpack.template.Template
    at org.jenkinsci.maven.plugins.hpi.ServletApiOnlyClassLoader.findClass(ServletApiOnlyClassLoader.java:25)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
    ... 42 more

Are there any packages that is needed? My pom file is below.
I am terribly sorry to bother you, but I want some advice what to do.
My machine is OSX mavericks and I use maven-3.0.5.
Thank you.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>1.509.4</version><!-- which version of Jenkins is this plugin built against? -->
  </parent>

  <groupId>com.lewuathe.plugins</groupId>
  <artifactId>jenkins-jubatus</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>hpi</packaging>

  <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
  <repositories>
    <repository>
      <id>repo.jenkins-ci.org</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </repository>

        <repository>
      <id>jubat.us</id>
      <name>Jubatus Repository for Maven</name>
      <url>http://download.jubat.us/maven</url>
        </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.jenkins-ci.org</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
        <dependency>
      <groupId>us.jubat</groupId>
      <artifactId>jubatus</artifactId>
      <version>0.5.0</version>
        </dependency>
  </dependencies>

</project>

java - session pool problem

I used msgpack connection with this sp.getSession(InetSocketAddress).
When I interrupt client, I met following warning.

Jul 24, 2012 10:23:41 PM org.msgpack.rpc.transport.PooledStreamClientTransport
INFO: Close channel [id: 0x7570b819, /10.0.0.27:40845 => /10.0.0.27:13640]
Jul 24, 2012 10:23:41 PM org.msgpack.rpc.transport.PooledStreamClientTransport
INFO: Close channel [id: 0x0a6a435f, /10.0.0.27:40241 => /10.0.0.27:13640]
.....

I wondered why there are so many connections even though I'm using connection pool.
I read source code and I found that I can use connection pool only I use "getSession(Address address)" form.
For other case, new IPAddress() is created and pool returns always null.

---------------- source code ------------------------------------------
public Session getSession(InetSocketAddress address) {
return getSession(new IPAddress(address));
}

Session getSession(Address address) {
synchronized (pool) {
Session s = pool.get(address);
if (s == null) {
s = new Session(address, config, loop);
pool.put(address, s);
}
return s;
}
}

Can't build generated code using maven

Hi,

Generated code from msgpack-idl 0.2.0 depends on msgpack >= 0.6.0, like this:

 @Message
 public class ClassName {

Latest version of msgpack-rpc for java in maven repository depends on msgpack 0.5.0-devel, like this:

    <dependency>
      <groupId>org.msgpack</groupId>
      <artifactId>msgpack</artifactId>
      <version>0.5.0-devel</version>
      <scope>compile</scope>
    </dependency>

I cannot build generated code using maven.

[ERROR] ClassName.java: cannot find symbol
[ERROR] symbol: class Message
[ERROR] @Message

Please update msgpack-rpc for java and these maven repository.

Sample client implementation in wiki does not exit from main()

Sample client implementation in wiki is:

import org.msgpack.rpc.Client;
import org.msgpack.rpc.loop.EventLoop;

public class ClientApp {
    public static interface RPCInterface {
        String hello(String msg, int a);
    }

    public static void main(String[] args) throws Exception {
        EventLoop loop = EventLoop.defaultEventLoop();

        Client cli = new Client("localhost", 1985, loop);
        RPCInterface iface = cli.proxy(RPCInterface.class);

        iface.hello("hello", 1);
    }
}

The problem is that client does not exist after returning from main(). It hangs in evenloop it seems. How to correctly terminate it?

Publish sources jar

The sources jar is published for msgpack but not for msgpack-rpc. It would ease debugging if the sources jar was published for msgpack-rpc aswell.

Ruby's client.notify not working properly

I can't seem to get a simple NOTIFY to work using the Ruby RPC libs. Here's an example client and server ...

server.rb:

require 'msgpack/rpc'

class Test

  def test_notify(x)
    puts x.inspect
  end

  def test_call(x)
    puts x.inspect
    x
  end
end

server = MessagePack::RPC::Server.new
server.listen('0.0.0.0', 9999, Test.new)
server.run

client.rb:

require 'msgpack/rpc'

client = MessagePack::RPC::Client.new('127.0.0.1', 9999)
client.call(:test_call, "test_call")
client.call(:test_notify, "test_notify")
client.notify(:test_notify, "test_notify2")

produces:

"test_call"
"test_notify"

[java]Can't run a java msgpack rpc server from Maven

When I tried to run rpc server by maven commad "mvn exec:java", it thrown the NotFoundException below.
If I make jar file and run it by "java -jar server.jar", it runs correctly.

org.msgpack.template.TemplateBuildException: javassist.NotFoundException: org.msgpack.template.JavassistTemplateBuilder$JavassistTemplate
    at org.msgpack.template.JavassistTemplateBuilder$BuildContextBase.build(JavassistTemplateBuilder.java:112)
    at org.msgpack.template.JavassistTemplateBuilder$BuildContext.buildTemplate(JavassistTemplateBuilder.java:237)
    at org.msgpack.template.JavassistTemplateBuilder.buildTemplate(JavassistTemplateBuilder.java:547)
    at org.msgpack.template.TemplateBuilder.buildTemplate(TemplateBuilder.java:127)
    at org.msgpack.template.TemplateBuilder.buildTemplate(TemplateBuilder.java:132)
    at org.msgpack.template.TemplateBuilder.build(TemplateBuilder.java:199)
    at org.msgpack.template.TemplateRegistry.lookupImpl(TemplateRegistry.java:122)
    at org.msgpack.template.TemplateRegistry.lookup(TemplateRegistry.java:77)
    at org.msgpack.rpc.reflect.ReflectionInvokerBuilder.buildInvoker(ReflectionInvokerBuilder.java:249)
    at org.msgpack.rpc.reflect.InvokerBuilder.buildInvoker(InvokerBuilder.java:129)
    at org.msgpack.rpc.reflect.InvokerBuilder.build(InvokerBuilder.java:162)
    at org.msgpack.rpc.reflect.Reflect.reflectInvoker(Reflect.java:32)
    at org.msgpack.rpc.dispatcher.MethodDispatcher.(MethodDispatcher.java:51)
    at org.msgpack.rpc.dispatcher.MethodDispatcher.(MethodDispatcher.java:42)
    at org.msgpack.rpc.dispatcher.MethodDispatcher.(MethodDispatcher.java:36)
    at org.msgpack.rpc.Server.serve(Server.java:61)
    at com.hoge.msgpacktest.Main.main(Main.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:290)
    at java.lang.Thread.run(Thread.java:619)
Caused by: javassist.NotFoundException: org.msgpack.template.JavassistTemplateBuilder$JavassistTemplate
    at javassist.ClassPool.get(ClassPool.java:436)
    at org.msgpack.template.JavassistTemplateBuilder.getCtClass(JavassistTemplateBuilder.java:68)
    at org.msgpack.template.JavassistTemplateBuilder$BuildContext.setSuperClass(JavassistTemplateBuilder.java:241)
    at org.msgpack.template.JavassistTemplateBuilder$BuildContextBase.buildClass(JavassistTemplateBuilder.java:123)
    at org.msgpack.template.JavassistTemplateBuilder$BuildContextBase.build(JavassistTemplateBuilder.java:97)

java - typo in NotifyMessage.java

I could't use notifyApply() because of this.

Index: src/main/java/org/msgpack/rpc/message/NotifyMessage.java
===================================================================
--- src/main/java/org/msgpack/rpc/message/NotifyMessage.java    (revision 474)
+++ src/main/java/org/msgpack/rpc/message/NotifyMessage.java    (working copy)
@@ -45,11 +45,12 @@
         pk.writeArrayBegin(3);
         pk.write(Messages.NOTIFY);
         pk.write(method);
-        pk.write(args.length);
+        pk.writeArrayBegin(args.length);
         for (Object arg : args) {
             pk.write(arg);
         }
         pk.writeArrayEnd();
+        pk.writeArrayEnd();
     }

     public void readFrom(Unpacker u) throws IOException {
Index: src/main/java/org/msgpack/rpc/message/RequestMessage.java
===================================================================
--- src/main/java/org/msgpack/rpc/message/RequestMessage.java   (revision 474)
+++ src/main/java/org/msgpack/rpc/message/RequestMessage.java   (working copy)
@@ -57,6 +57,7 @@
             pk.write(arg);
         }
         pk.writeArrayEnd();
+        pk.writeArrayEnd();
     }

     public void readFrom(Unpacker u) throws IOException {

cpp: make check libcclog.a missing

When I do a 'make check' in cpp I get an error because libcclog.a is missing.

libtool: link: g++ -O4 -Wall -g -DCCLOG_LEVEL=10 -msgpack -o .libs/sync_call sync_call.o ../src/cclog/.libs/libcclog.a ../src/msgpack/rpc/.libs/libmsgpack-rpc.so /usr/local/lib/libmpio.so /usr/local/lib/libmsgpack.so -lz -lpthread -lstdc++ -Wl,-rpath -Wl,/usr/local/lib
g++: error: ../src/cclog/.libs/libcclog.a: No such file or directory

I can see that the Makefile in cclog has some commented out lines:

lib_LTLIBRARIES = libcclog.la

libcclog_la_includedir = $(includedir)/cclog

libcclog_la_SOURCES = \

cclog.cc \

cclog_null.cc \

cclog_ostream.cc \

cclog_syslog.cc \

cclog_tty.cc

libcclog_la_include_HEADERS = \

cclog.h \

cclog_null.h \

cclog_ostream.h \

cclog_syslog.h \

cclog_tty.h

EXTRA_DIST = \

cclog.hmpl

But when I uncomment them I get a build error:

make[2]: Entering directory /home/las/dev/msgpack-rpc/cpp/test' /bin/sh ../libtool --tag=CXX --mode=link g++ -O4 -Wall -g -DCCLOG_LEVEL=10 ../src/cclog/libcclog.la ../src/msgpack/rpc/libmsgpack-rpc.la -lmpio -msgpack -o sync_call sync_call.o -lmpio -lmsgpack -lz -lpthread -lstdc++ libtool: link: g++ -O4 -Wall -g -DCCLOG_LEVEL=10 -msgpack -o .libs/sync_call sync_call.o ../src/cclog/.libs/libcclog.a ../src/msgpack/rpc/.libs/libmsgpack-rpc.so /usr/local/lib/libmpio.so /usr/local/lib/libmsgpack.so -lz -lpthread -lstdc++ -Wl,-rpath -Wl,/usr/local/lib sync_call.o: In functionmain':
/home/las/dev/msgpack-rpc/cpp/test/sync_call.cc:9: undefined reference to cclog_tty::cclog_tty(cclog::level, std::basic_ostream<char, std::char_traits<char> >&)' /home/las/dev/msgpack-rpc/cpp/test/sync_call.cc:9: undefined reference tocclog::reset(cclog*)'

gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)

#include <mp/unordered_map.h> does not exist.

Well as the title says, that file does not exist.

I'm trying to compile msgpack-rpc c++ (if there's a c version that works that would be ok I guess)

when making the project I get:
address.h:29:30: error: mp/unordered_map.h: No such file or directory

what is this mp/unordered_map.h and where am I supposed to get it?

Thank you

Confusing picture explaining pipeline feature

In the picture explaining the pipeline feature, the msgids of the tasks are switched when the tasks are reordered. I think this is an error as the msgid is meant to signal this reordering.

Pipeline feature

Java - process not exit

NettyEventLoop class has not override EventLoop.shutdown().
XXXXSocketChannkeFactory.releaseExternalResource() should call for netty shutdown
so netty's thread(Hashed wheel timer) never die.( I'm using netty 3.5.8.Final)

NettyEventLoop.java

   @Override
    public void shutdown() {
        if( clientFactory != null ){
            clientFactory.releaseExternalResources();
        }
        if( serverFactory != null ){
            serverFactory.releaseExternalResources();
        }
        super.shutdown();
    }

java: Broken dependencies on msgpack 0.4 in pom.xml

I want to build msgpack-rpc for java on master head.

In the pom.xml, version of msgpack in dependencies is 0.4, I don't know how to get/build it from source. I checked msgpack repository, the version of java is 0.3 now.

Haskell test application blocks on Windows

Running the example code on Linux runs fine, running the same on Windows XP blocks.

Compiled, using _Haskell Platform-2011.2.0.0_, Cli.hs and Serv.hs using the following command: ghc --make <file>.

Encryption & authentication

It would be nice to have have some encryption / authentication ability. At least encrypt all trafic to be able safely pass some token or login / password to some function.

Duplicate files at same path --> cannot package for android

Android packages do not store .jar files separately, so filepaths have to be unique in a package. Trying to build an .apk for a project, which uses msgpack-rpc results in "[ERROR] Cannot add resources from jar Duplicate files at the same path inside the APK" most of the time (and I have no idea why it did work at first, doubting whether it did...). This issue may not actually be messagepack's fault, but it makes msgpack-rpc unuseable with android.

There is a possible workaround for this problem using Maven Android Plugin 2.9.0-beta-1 or newer, which should automatically remove duplicate files.

msgpack::rpc::connect_error

Hi,

I'm trying to catch the connect error as written in the test file:

try {
rpc::client cli("127.0.0.1", 16396);
cli.call("add", 1, 2).get();
} catch(msgpack::rpc::connect_error& e) {
std::cout << "ok: "<< e.what() << std::endl;
}

but the error is catched only if I use the 127.x.x.x class or 0.x.x.x class.
I've tryed also to catch msgpack::rpc::remote_error or msgpack::rpc::timeout_error but the result is the same.

I'm using C++ language.

Yuri

Feature req: SSL Transport for Ruby

It would be really nice to have a SSL transport in ruby.

I thought this should be easy, but my tests with Rev::SSLSocket did not work out. I get an on_connect event, but the endpoints never handshake (on_ssl_connect never happens). I even tried the "monkeypatch"-route with TCPSocket and ssl_start_*, but no success either.

Perhaps one of the core devs could have a go at this?

Mutable method parameters in msgpack-rpc java

As of now, I looked into all possible sources of information if this is available in msgpack-rpc/Java, but receiving back the mutated parameter doesn't seem possible. Though it seems like that it is possible to use mutable parameters in Scala implementation.

build tests

How do I build tests and cclog,a under fedora from git sources?

I tried to make callback, but then libcclog.la is missing, and I am not sure how to build libcclog in cpp/src/cclog

[las@localhost test]$ make callback
/bin/sh ../libtool --tag=CXX --mode=link g++ -O4 -Wall -g -DCCLOG_LEVEL=10 ../src/cclog/libcclog.la ../src/msgpack/rpc/libmsgpack-rpc.la -lmpio -msgpack -o callback callback.o -lmpio -lmsgpack -lz -lpthread -lstdc++
libtool: link: cannot find the library ../src/cclog/libcclog.la' or unhandled argument../src/cclog/libcclog.la'
make: *** [callback] Error 1

missing files for run_heavy_attack

I seems as if some files are missing in git?

When I run the script run_heavy_attack.sh I get this error:

tcp test
./run_heavy_attack.sh: line 10: ./attack_connect: No such file or directory
./run_heavy_attack.sh: line 11: ./attack_pipeline: No such file or directory
./run_heavy_attack.sh: line 12: ./attack_callback: No such file or directory
./run_heavy_attack.sh: line 13: ./attack_huge: No such file or directory

gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC)

Exception raises on java server at high concurrency

I was trying to test and benchmark msgpack-rpc today with msgpack-rpc-scala as server and msgpack-rpc-python as client.

They are really of high performance, where i achieved 60,000 qps for async calls.

But exceptions were raised at server side when concurrency comes to 1000 level.

 Dec 10, 2012 12:10:11 AM org.jboss.netty.channel.SimpleChannelUpstreamHandler
WARNING: EXCEPTION, please implement org.msgpack.rpc.loop.netty.MessageHandler.exceptionCaught() for proper handling.
java.lang.IndexOutOfBoundsException
    at org.jboss.netty.buffer.AbstractChannelBuffer.skipBytes(AbstractChannelBuffer.java:388)
    at org.msgpack.rpc.loop.netty.MessagePackStreamDecoder.decode(MessagePackStreamDecoder.java:58)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:282)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:214)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201)
    at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

It seems to be a netty's exception which should be handled by org.msgpack.rpc.loop.netty.MessageHandler.exceptionCaught(), but this was not implemented.

Java - how to handle generic types

Hi,

I'm using RPC with a type that uses generic types.

The RPC method looks something like:

public Result doCommand(Command command) {

the Command class is as follows:

public class Command<D extends Data> extends SomethingSuper {
    private String id;
//more fields here
    private D data;

When creating the server I register the types that are being used and register command as such:

MessagePack msgPack = new MessagePack();
msgPack.register(ImplementationForD.class);
msgPack.register(Command.class);

and this conveniently creates a template object that handles correctly all the fields except for generic types D. I also register the implementations for types D.

When it comes to de-serialization msgpack picks up the field data as of type D for which it doesn't have any template that could be applied to read the value.

Please advise on how to solve this - if at all possible.

Google Go

Could you please update msgpack-rpc and examples for google go (as long as version 1 is released and it should be compatible with future versions of go). Thanks

Java RPC: Remote exceptions never transmitted as errors

The server code for exception handling appears to be incorrect and does not catch any exception, in fact it catches only one kind of exception: the InvocationTargetException (http://download.oracle.com/javase/6/docs/api/java/lang/reflect/InvocationTargetException.html), that is because as the methods are invoked from the target, Java wraps all thrown exceptions into an InvocationTargetException that contains no data except for its cause (the thrown exception). The real problem is that the code treats it as a general exception and tries tio get the message from it (which is null), then the rpc.Request.sendError function sends a message with a null error and treats it as if there was no error at all, thus sending a frame with no return value and no error. From the client point of view if the function has no return value, you cannot see an error happened, and if it has a return value then the code breaks when it tries to convert the empty message into whatever value should be returned (throwing a MessageTypeException as if the function did not returned the good type of value).

In order to circumvent this problem, I had to create a class inherited from rpc.Server and override the OnRequest method so the InvocationTargetException would be catched, its cause retrieved and sent as an error.

Also you should make sure in the code that rpc.Request.sendError always send an object (eventually an UnknownError inheriting from RPCError) so when it is called the client always know there has been an error.

If you don't have time to patch this I could probably give you a working code, but I think this is a really critical bug that should not stay open.

Forgot to put attack.h file in test

Hi developers,

I think you forgot to put attack.h file in msgpack-rpc-0.3.1
so make check fails to compile.

msgpack-rpc / cpp / test / Makefile.am
...

attack_connect_SOURCES = attack_connect.cc

attack_pipeline_SOURCES = attack_pipeline.cc

attack_huge_SOURCES = attack_huge.cc

attack_callback_SOURCES = attack_callback.cc

kumofs and msgpack are great jobs!
Thanks for your hard work.

Kiwi

Haskell: Test application doesn't compile

I tried compiling the server application with

ghc Serv.hs

but I get an error message:

test/serv.hs:17:24:
No instance for (MethodType (IO Int) IO)
      arising from a use of `toMethod'
    Possible fix:
      add an instance declaration for (MethodType (IO Int) IO)
    In the expression: toMethod add
    In the expression: ("add", toMethod add)
    In the second argument of `serve', namely
      `[("add", toMethod add), ("echo", toMethod echo)]'

test/serv.hs:17:48:
    No instance for (MethodType (IO String) IO)
      arising from a use of `toMethod'
    Possible fix:
      add an instance declaration for (MethodType (IO String) IO)
    In the expression: toMethod echo
    In the expression: ("echo", toMethod echo)
    In the second argument of `serve', namely
      `[("add", toMethod add), ("echo", toMethod echo)]'

but when I change the type of the rpc methods everything compiles just fine:

Swap

add :: Int -> Int -> IO Int

with

add :: Int -> Int -> Method Int

and

echo :: String -> IO String

with

echo :: String -> Method String

I should add that I'm a complete newbie in Haskell so the error might be totally on my side.

Request for Elaboration: Notification Message Type

Hello!

I've recently been writing a very small barebones msgpack-rpc implementation for a project that I'm working on, and I had a few questions about the Notification type messages that I feel like might warrant in-spec elaboration. Namely, there's no notes on the intended usage of the notification messages. This leaves many questions unanswered. Should these be server-to-client, client-to-server, or both? Can these be used for one-way (nonblocking, non-returning) method calls, or should they just be used to inform one party of the status of a running program? Does a specific context need to be established (e.g. by the running of a procedure) before they can be sent, or can they be sent whenever?

If anyone knows, I'd really appreciate an answer, and would even be willing to write the spec update PR myself, if need be.

Thank you!

Java - no way to get remote client's IP address

By googling, I found some method in apache thrift.

((TSocket)inProt.getTransport()).getSocket().getInetAddress()

This is network protocol layer, so need to know about remote client because of security and access control.

Add implementation in Rust

There is now an implementation for MsgPack in Rust.

Since this here seems to be the central place for MsgPack-RPC libraries, please add implementation in Rust; potentially using the aforementioned encoder/decoder library already present.

Thanks.

Compilation problem on arch linux and gcc 4.5.0 (prerelease)

I'm running Archlinux and msgpack-rpc fails to compile with the following error:

In file included from session.h:22:0,
from session_impl.h:21,
from future_impl.h:22,
from exception_impl.h:22,
from exception.cc:18:
address.h: In member function ‘uint16_t msgpack::rpc::address::raw_port() const’:
address.h:121:42: warning: dereferencing type-punned pointer will break strict-aliasing rules
address.h: In member function ‘void msgpack::rpc::address::set_port(uint16_t)’:
address.h:152:31: warning: dereferencing type-punned pointer will break strict-aliasing rules
exception.cc: At global scope:
exception.cc:33:6: error: no matching function for call to ‘msgpack::object::object(msgpack::type::raw_ref)’
/usr/local/msgpack/include/msgpack/object.hpp:189:8: note: candidates are: msgpack::object::object(msgpack_object)
/usr/local/msgpack/include/msgpack/object.hpp:187:8: note: msgpack::object::object()
/usr/local/msgpack/include/msgpack/object.hpp:67:15: note: msgpack::object::object(const msgpack::object&)
exception.cc:37:6: error: no matching function for call to ‘msgpack::object::object(msgpack::type::raw_ref)’
/usr/local/msgpack/include/msgpack/object.hpp:189:8: note: candidates are: msgpack::object::object(msgpack_object)
/usr/local/msgpack/include/msgpack/object.hpp:187:8: note: msgpack::object::object()
/usr/local/msgpack/include/msgpack/object.hpp:67:15: note: msgpack::object::object(const msgpack::object&)
make[3]: *** [libmsgpack_rpc_la-exception.lo] Error 1

Regards,
Ryan

gcc -v:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-lto --enable-plugin --disable-multilib --disable-libstdcxx-pch --with-system-zlib --with-ppl --with-cloog --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
Thread model: posix
gcc version 4.5.0 20100520 (prerelease) (GCC)

PHP RPC Client issue

public function clientConnection($host, $port, $call)
{
$size = $this->size;
$send = $this->msgpackEncode($call);
$sock = fsockopen($host, $port);
if ($sock === FALSE) throw new Exception($this->errorMessage01);
$puts = fputs($sock, $send);
if ($puts === FALSE) throw new Exception($this->errorMessage01);
$read = fread($sock, $size);
if ($read === FALSE) throw new Exception($this->errorMessage01);
$end = fclose($sock);

return $read;

}

$read = fread($sock, $size);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If I send 100K data
this line can't receive all data..
So unpack data will send error...

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.