Code Monkey home page Code Monkey logo

jeromq3-x's Introduction

#JeroMQ

Pure Java implementation of libzmq (http://zeromq.org)

Build Status

Features

  • based on libzmq 3.2.2
  • ZMTP/2.0 (http://rfc.zeromq.org/spec:15)
  • tcp:// protocol and inproc:// is compatible with zeromq
  • ipc:// protocol works only between jeromq (uses tcp://127.0.0.1:port internally)
  • not too bad performance compared to zeromq
  • 2M messages (100B) per sec
  • Performance
  • exactly same develope experience with zeromq and jzmq

Not supported Features

  • ipc:// protocol with zeromq. Java doesn't support UNIX domain socket.
  • pgm:// protocol. Cannot find a pgm Java implementation

Extended Features

Contribution Process

This project uses the C4 process for all code changes. "Everyone, without distinction or discrimination, SHALL have an equal right to become a Contributor under the terms of this contract."

Usage

Add it to your Maven project's pom.xml:

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

<!-- for the latest SNAPSHOT -->
<dependency>
  <groupId>org.zeromq</groupId>
  <artifactId>jeromq</artifactId>
  <version>0.3.4-SNAPSHOT</version>
</dependency>

<!-- If you can't find the latest snapshot -->
<repositories>
  <repository>
    <id>sonatype-nexus-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
   </repository>
</repositories>

If your are using the Ant

ant [target]

Also please refer the Wiki

jeromq3-x's People

Contributors

baboune avatar capacman avatar cbusbey avatar cossin avatar crocket avatar davipt avatar hachikuji avatar hintjens avatar imleon avatar ipechorin avatar jkwatson avatar miniway avatar nomjon avatar trevorbernard avatar vsg avatar xekoukou avatar

Stargazers

 avatar  avatar  avatar

Watchers

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

jeromq3-x's Issues

Lockup when closing ZContext

Using jeromq 3.2.2 there appears to be an issue when closing ZContext. There's a pretty easy workaround but it would be nice if this worked in the way I expect as that would support Java 1.7 "try-with-resource" constructs. Or maybe my understanding of how this is meant to work is incorrect?

I would like to write code like this:

// Initialise ZMQ
try (ZContext z_context = new ZContext()) {

    // Create a response socket
  try (Socket z_responder = z_context.createSocket(ZMQ.ZMQ_REP)) {

      z_responder.bind("tcp://*:5555");
      try {
        // Normally we'd do stuff here....
      }
      finally {
        z_responder.disconnect("tcp://*:5555");
      }

  }
}  // Issue - lock up in implicit close of context here

But this locks up when the context is closed.

The lockup appears to be casued by a NullPointerException in Ctx.destroy_socket().

Exception in thread "reaper-1" java.lang.NullPointerException
    at zmq.Ctx.destroy_socket(Ctx.java:333)
    at zmq.ZObject.destroy_socket(ZObject.java:144)
    at zmq.SocketBase.check_destroy(SocketBase.java:964)
    at zmq.SocketBase.start_reaping(SocketBase.java:779)
    at zmq.Reaper.process_reap(Reaper.java:133)
    at zmq.ZObject.process_command(ZObject.java:114)
    at zmq.Reaper.in_event(Reaper.java:90)
    at zmq.Poller.run(Poller.java:237)
    at java.lang.Thread.run(Unknown Source)

This is the work around - by not closing the socket.

// Initialise ZMQ
try (ZContext z_context = new ZContext()) {

    // Create a response socket
  @SuppressWarnings("resource") // Have to suppress this warning about not closing
  Socket z_responder = z_context.createSocket(ZMQ.ZMQ_REP);

  try {
      z_responder.bind("tcp://*:5555");

      try {
        // Normally we'd do stuff here....
      }
      finally {
        z_responder.disconnect("tcp://*:5555");
      }

  }
  finally {
      // Don't close the socket here else the context will lock 
      // z_responder.close();
  }
}

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.