Skip to content
Lukas Schmelzeisen edited this page Dec 25, 2013 · 3 revisions

Java Implementation

For implementation you have the choice between JZMQ (a JNI binding to the C API) and JeroMQ (a pure java ZMQ implementation). JZMQ runs a bit faster, since it accesses native C bindings, but needs to be compiled by hand. I recommend using Jeromq, for ease of deployment, better cross-plattform-support, and since runtime speed of the library is unlikely to become a bottleneck.

To use JeroMq, add this to your Maven project's pom.xml

<dependency>
  <groupId>org.zeromq</groupId>
  <artifactId>jeromq</artifactId>
  <version>0.3.2</version>
</dependency>

Java Executing

With the switch to ZMQ our backend components will no longer be java servlets but indepented executable programms. Here is how you start a Java programm:

Without arguments

mvn exec:java -Dexec.mainClass="de.metalcon.MyMainClass"

With arguments:

mvn exec:java -Dexec.mainClass="de.metalcon.MyMainClass" -Dexec.args="arg0 arg1 arg2"

Where de.metalcon.MyMainClass is a class implementing public static void main(String[] args).

To be able to just use mvn exec:java add this to your pom.xml:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.2.1</version>
  <executions>
    <execution>
      <goals>
        <goal>java</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <mainClass>de.metalcon.MyMainClass</mainClass>
    <arguments>
      <argument>arg0</argument>
      <argument>arg1</argument>
    </arguments>
  </configuration>
</plugin>

Documentation

Clone this wiki locally