简体   繁体   中英

Calling Java functions from R using RProtoBuf (Protocol Buffers)

It is not entirely obvious how to go about using RProtoBuf for communicating between R and other languages (Java, in my case).

The RprotoBuf Developers developed something that is still here - https://r-forge.r-project.org/scm/viewvc.php/java/?root=rprotobuf , but it seems very outdated. I am not sure if this is the way to go. Here are two conversations between the authors of RProtoBuf that might help with understanding the code -

http://lists.r-forge.r-project.org/pipermail/rprotobuf-yada/2009-December/000116.html

http://lists.r-forge.r-project.org/pipermail/rprotobuf-yada/2009-December/000119.html

It seems that they started work with Java and then abandoned it in C++'s favour!

Is there anyone using R-RProtoBuf-Java combination? How do you do it? Is there a tutorial or example available?

My exposure to Java is very very limited. I want to use a few programs written in Java.

Edit: To clarify, I suppose I want to see an example of an R rpc client being used with RProtobuf. Pointers towards Java RPC servers would be welcome.

Edit2: The first link actually points to some documentation generator code, as Dirk pointed out.

We have recently published a preprint on arXiv of a JSS paper we wrote with more examples of using RProtoBuf, including sending RPC requests to remote web services. For more exposition of sharing data between R and other languages with RProtoBuf, see RProtoBuf: Efficient Cross-Language Data Serialization in R .

You can use RProtoBuf with any transport mechanism, as explained in the article -- You can save serialized protocol buffers to files to be read by other applications written in other languages, or you can send them over connections/sockets or other higher level RPC systems. Protocol Buffers are widely used in everything from Sony Playstations to large scale web services, but they do not include an RPC system -- you use them as your serialization format with whatever transport system you are already using.

I don't know about RProtoBuf, but if you just want to call Java from R, then you might be interested in rJava .

It is not outdated and has examples (right on the main page, see the link).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM