Made zmq port configureable

Updated Readme.md file
This commit is contained in:
2014-04-08 10:09:05 +02:00
parent 8522d46813
commit 76c40ccf28
6 changed files with 43 additions and 7 deletions
+28
View File
@@ -4,6 +4,34 @@ This package holds the core functionality of FDA.
# Usage
use -Djava.util.logging.config.file=logging.properties` to configure logging
## Server
The FDA server is started as follows:
```
./bin/server -h
usage: fda
-h Help
-p <arg> Server port (default: 8080)
-s <arg> Server address (default: x07mb-cons-1)
```
Start new scan:
```
curl -X PUT -d @scan1d.xml -H 'Content-Type:application/xml' http://emac:8080/fda/scan
```
## Viewer
```
./bin/viewer -h
usage: viewer
-h Help
-p <arg> Server port (default: 10000)
-s <arg> Server address (default: localhost)
```
# Development
When checking out the project from the repository there is the `target/generated-sources/xjc` folder missing.
After checking out the project execute `mvn compile` to create the folder and the required classes.
+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.psi</groupId>
<artifactId>fda</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<dependencies>
+5 -1
View File
@@ -1,4 +1,8 @@
<assembly>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bin</id>
<!-- Generates a zip package containing the needed files -->
<formats>
@@ -1,6 +1,7 @@
package ch.psi.fda.rest;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URI;
import java.util.concurrent.CountDownLatch;
import java.util.logging.Logger;
@@ -29,8 +30,7 @@ public class FdaServer {
public static void main(String[] args) throws IOException, ParseException {
int port = 8080;
// String hostname = InetAddress.getLocalHost().getHostName();
String hostname = "localhost";
String hostname = InetAddress.getLocalHost().getHostName();
Options options = new Options();
options.addOption("h", false, "Help");
@@ -20,7 +20,9 @@ public class ResourceBinder extends AbstractBinder {
bind(AcquisitionEngine.class).to(AcquisitionEngine.class).in(Singleton.class);
bind(FdaqEngine.class).to(FdaqEngine.class).in(Singleton.class);
bind(ZMQDataService.class).to(ZMQDataService.class).in(Singleton.class);
// ZMQ data service singleton
bind(new ZMQDataService(10000)).to(ZMQDataService.class);
bind(CdumpEngine.class).to(CdumpEngine.class).in(Singleton.class);
bind(CdumpConfiguration.class).to(CdumpConfiguration.class).in(Singleton.class);
@@ -41,13 +41,15 @@ public class ZMQDataService {
private static final Logger logger = Logger.getLogger(ZMQDataService.class.getName());
private final int bufferSize = 5;
private final int port;
private ZMQ.Context context;
private ZMQ.Socket socket;
private String trackingId;
public ZMQDataService(){
public ZMQDataService(int port){
this.port = port;
initialize();
}
@@ -56,7 +58,7 @@ public class ZMQDataService {
zmq.ZError.clear(); // Clear error code
socket = context.socket(ZMQ.PUB);
socket.setHWM(bufferSize);
socket.bind("tcp://*:10000");
socket.bind("tcp://*:"+port);
}
public void terminate(){