GithubHelp home page GithubHelp logo

jeromq's Introduction

JeroMQ

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

Build Status Coverage Status Maven Central Javadocs

Features

  • Based on libzmq 4.1.7.

  • ZMTP/3.0 (http://rfc.zeromq.org/spec:23).

  • tcp:// protocol and inproc:// is compatible with zeromq.

  • ipc:// protocol works only between jeromq (uses tcp://127.0.0.1:port internally).

  • Securities

  • Performance that's not too bad, compared to native libzmq.

  • Exactly same developer experience with zeromq and jzmq.

Unsupported

  • ipc:// protocol with zeromq. Java doesn't support UNIX domain socket.

  • pgm:// protocol. Cannot find a pgm Java implementation.

  • norm:// protocol. Cannot find a Java implementation.

  • tipc:// protocol. Cannot find a Java implementation.

  • GSSAPI mechanism is not yet implemented.

  • TCP KeepAlive Count, Idle, Interval cannot be set via Java but as OS level.

  • Interrupting threads is still unsupported: library is NOT Thread.interrupt safe.

Contributing

Contributions welcome! See CONTRIBUTING.md for details about the contribution process and useful development tasks.

Usage

Maven

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

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

    <!-- for the latest SNAPSHOT -->
    <dependency>
      <groupId>org.zeromq</groupId>
      <artifactId>jeromq</artifactId>
      <version>0.5.2-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>

Ant

To generate an ant build file from pom.xml, issue the following command:

mvn ant:ant

Getting started

Simple example

Here is how you might implement a server that prints the messages it receives and responds to them with "Hello, world!":

import org.zeromq.ZMQ;
import org.zeromq.ZContext;

public class hwserver
{
    public static void main(String[] args) throws Exception
    {
        try (ZContext context = new ZContext()) {
            // Socket to talk to clients
            ZMQ.Socket socket = context.createSocket(ZMQ.REP);
            socket.bind("tcp://*:5555");

            while (!Thread.currentThread().isInterrupted()) {
                // Block until a message is received
                byte[] reply = socket.recv(0);

                // Print the message
                System.out.println(
                    "Received: [" + new String(reply, ZMQ.CHARSET) + "]"
                );

                // Send a response
                String response = "Hello, world!";
                socket.send(response.getBytes(ZMQ.CHARSET), 0);
            }
        }
    }
}

More examples

The JeroMQ translations of the zguide examples are a good reference for recommended usage.

(Note that the Java examples in the zguide itself are out of date and do not necessarily reflect current recommended practices with JeroMQ.)

Documentation

For API-level documentation, see the Javadocs.

This repo also has a doc folder, which contains assorted "how to do X" guides and other useful information about various topics related to using JeroMQ.

License

All source files are copyright © 2007-2020 contributors as noted in the AUTHORS file.

Free use of this software is granted under the terms of the Mozilla Public License 2.0. For details see the file LICENSE included with the JeroMQ distribution.

jeromq's People

Contributors

trevorbernard avatar miniway avatar daveyarwood avatar fredoboulo avatar ipechorin avatar c-rack avatar isahkemat avatar fbacchella avatar hintjens avatar markif avatar kylemallory avatar refactormachine avatar bvella avatar knuesel avatar dermesser avatar imkcy9 avatar garydgregory avatar sjohnr avatar sbanacho avatar ealgell avatar davipt avatar hachikuji avatar crocket avatar capacman avatar parente avatar jkwatson avatar jcoeltjen avatar ianbishop avatar heinrichhartmann avatar xinhochen avatar

Watchers

James Cloos avatar

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.