Use jeromq instead of jzmq.

This commit is contained in:
Clark Boylan 2013-01-25 13:42:38 -08:00
parent 28d5017b4a
commit 8d334cd9a9
3 changed files with 13 additions and 39 deletions

30
README
View File

@ -4,32 +4,14 @@ socket is on TCP port 8888 and no Job events will be published.
You can choose to enable event publishing for all jobs in the
Jenkins' global config or enable the plugin on a per job basis.
To build this plugin you will need to have libzmq installed on your
Jenkins server. You will also need to build a local copy of jzmq
for the architecture of your Jenkins server. To get a build of jzmq
that worked I had to tweak jzmq version 2.1.0 slightly. You can
get that version at:
https://github.com/cboylan/jzmq
First clone the above repository and check out the 2.1.0-build-fix
branch. Then run the following commands to build jzmq:
./autogen.sh && ./configure && make
#I had to skip tests as they would not run
maven clean install -Dmaven.test.skip=true
Now you can build this plugin:
maven clean package
# Copy target/zmq-event-publisher.hpi to the Jenkins
# plugin dir and restart Jenkins.
All of this will be much easier if you use the same OS and CPU
architecture on your build host as on the Jenkins server.
This plugin uses jeromq to satisfy the dependency on ZMQ. It is
possible to use jzmq instead if you need the features that jeromq
is lacking; however, it is a pain to get jzmq built and is less
portable. If you really really want jzmq look back in the git
history and you will find the old versions of this plugin that
depended on jzmq.
TODO:
Better error handling (eg bind errors due to port conflicts)
Avoid reading in the global config for each event if possible.
Cleanup config.jelly for the non global Job config.

17
pom.xml
View File

@ -64,23 +64,16 @@
</repositories>
<dependencies>
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jzmq</artifactId>
<version>2.1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jzmq</artifactId>
<version>2.1.0-SNAPSHOT</version>
<classifier>native-${os.arch}-${native.os}</classifier>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.jeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
<profiles>

View File

@ -27,8 +27,8 @@ import hudson.model.listeners.RunListener;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.zeromq.ZMQ;
import org.zeromq.ZMQException;
import org.jeromq.ZMQ;
import org.jeromq.ZMQException;
/*
* Listener to publish Jenkins build events through ZMQ
@ -68,7 +68,6 @@ public class RunListenerImpl extends RunListener<Run> {
LOGGER.log(Level.INFO,
String.format("Changing ZMQ PUB port from %d to %d", port, tmpPort));
try {
publisher.unbind(bind_addr);
publisher.close();
} catch (ZMQException e) {
/* Let the garbage collector sort out cleanup */