Giter VIP home page Giter VIP logo

erl4j's Introduction

Erl4j provides a framework for creating Java daemons that can respond to Erlang RPC messages. 

Dependencies:
 * Java 1.6
 * jsvc 1.0.1 (http://commons.apache.org/daemon/jsvc.html)
 * Jinterface 1.5.1 (part of Erlang/OTP)
 * Rake 0.8.7
 
Erl4j may work with other versions of those dependencies, but those are just the ones I've tested it in.

Before running Erl4j, make sure that epmd is running, otherwise it won't be able to publish its port to other Erlang nodes. To start epmd:
  /usr/local/lib/erlang/erts-$SOME_VERSION/bin/epmd -daemon
  
To start a server with the samples, run:
  rake run

To test it out, start an Erlang process with:
  erl -sname my_node

For some reason, it won't work without the sname param.

Then from the interpreter you can run:
  rpc:call('erl4j@my_host', my_module, my_function, [param1, param2]).

And it should echo the call back to you:
  {call,my_module,my_function,[param1, param2],<0.31.0>}

To create your own Erl4j server, you just have to implement the Erl4jHandler interface which is simply:

  public interface Erl4jHandler {
      public OtpErlangObject respond(Erl4jRequest request);
  }

Then update bin/erl4jctl.conf to use your Erl4jHandler implementation class. 

OtpErlangObject is Jinterface's Java representation of an Erlang term. See http://www.erlang.org/doc/apps/jinterface/jinterface_users_guide.html.

See erl4j-sample/com/syntacticbayleaves/erl4j/sample/ for examples.

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.