diff --git a/examples/dds/CMakeLists.txt b/examples/dds/CMakeLists.txt
index 8ed9b99f..6641ec69 100644
--- a/examples/dds/CMakeLists.txt
+++ b/examples/dds/CMakeLists.txt
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
+# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
@@ -28,12 +28,12 @@ target_link_libraries(fairmq-ex-dds-sink PRIVATE ExampleDDSLib)
add_custom_target(ExampleDDS DEPENDS fairmq-ex-dds-sampler fairmq-ex-dds-processor fairmq-ex-dds-sink)
-set(EX_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
-set(DDS_PLUGIN_LIB_DIR ${CMAKE_BINARY_DIR}/fairmq/plugins/DDS)
-set(FAIRMQ_BIN_DIR ${CMAKE_BINARY_DIR}/fairmq)
+set(BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(PLUGIN_DIR ${CMAKE_BINARY_DIR}/fairmq/plugins/DDS)
+set(DATA_DIR ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml @ONLY)
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-hosts.cfg ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg COPYONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-dds.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh @ONLY)
# test
@@ -50,10 +50,11 @@ install(
)
# configure run script with different executable paths for build and for install directories
-set(EX_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR})
-set(DDS_PLUGIN_LIB_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR})
-set(FAIRMQ_BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR}/fairmq)
+set(BIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_BINDIR})
+set(PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_LIBDIR})
+set(DATA_DIR ${CMAKE_INSTALL_PREFIX}/${PROJECT_INSTALL_DATADIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ex-dds-topology.xml ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-dds.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh_install @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-topology.xml_install
@@ -65,3 +66,9 @@ install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ex-dds-hosts.cfg
DESTINATION ${PROJECT_INSTALL_DATADIR}
)
+
+install(
+ PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-dds.sh_install
+ DESTINATION ${PROJECT_INSTALL_BINDIR}
+ RENAME fairmq-start-ex-dds.sh
+)
diff --git a/examples/dds/ex-dds-topology.xml b/examples/dds/ex-dds-topology.xml
index 851dd28e..1539c3fd 100644
--- a/examples/dds/ex-dds-topology.xml
+++ b/examples/dds/ex-dds-topology.xml
@@ -7,8 +7,8 @@
-
- @EX_BIN_DIR@/fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds
+
+ fairmq-ex-dds-sampler --id sampler --channel-config name=data1,type=push,method=bind -S "<@PLUGIN_DIR@/" -P dds
SamplerWorker
@@ -17,10 +17,10 @@
-
- @EX_BIN_DIR@/fairmq-ex-dds-processor --id processor_%taskIndex% --config-key processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds
+
+ fairmq-ex-dds-processor --id processor_%taskIndex% --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "<@PLUGIN_DIR@/" -P dds
- ProcessorWorker
+ ProcessWorker
data1
@@ -28,8 +28,8 @@
-
- @EX_BIN_DIR@/fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds
+
+ fairmq-ex-dds-sink --id sink --channel-config name=data2,type=pull,method=bind -S "<@PLUGIN_DIR@/" -P dds
SinkWorker
diff --git a/examples/dds/fairmq-start-ex-dds.sh.in b/examples/dds/fairmq-start-ex-dds.sh.in
new file mode 100755
index 00000000..c345cc66
--- /dev/null
+++ b/examples/dds/fairmq-start-ex-dds.sh.in
@@ -0,0 +1,58 @@
+#!/usr/bin/env bash
+
+################################################################################
+# Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
+# #
+# This software is distributed under the terms of the #
+# GNU Lesser General Public Licence (LGPL) version 3, #
+# copied verbatim in the file "LICENSE" #
+################################################################################
+
+set -e
+
+cleanup() {
+ dds-session stop $1
+ echo "CLEANUP PERFORMED"
+}
+
+source @DDS_INSTALL_PREFIX@/DDS_env.sh
+export PATH=@BIN_DIR@:@PLUGIN_DIR@:$PATH
+
+exec 5>&1
+output=$(dds-session start | tee >(cat - >&5))
+export DDS_SESSION_ID=$(echo ${output} | grep "DDS session ID: " | cut -d' ' -f4)
+echo "SESSION ID: ${DDS_SESSION_ID}"
+
+trap "cleanup ${DDS_SESSION_ID}" EXIT
+
+requiredNofAgents=12
+dds-submit -s ${DDS_SESSION_ID} -r localhost -n ${requiredNofAgents}
+dds-info -s ${DDS_SESSION_ID} --wait-for-idle-agents ${requiredNofAgents}
+
+topologyFile=@DATA_DIR@/ex-dds-topology.xml
+echo "TOPOLOGY FILE: ${topologyFile}"
+
+dds-topology -s ${DDS_SESSION_ID} --disable-validation --activate ${topologyFile}
+
+echo "------------------------"
+echo "Waiting for Topology to finish ..."
+sampler_and_sink="main/(Sampler|Sink)"
+fairmq-dds-command-ui -p $sampler_and_sink --wait-for-state RUNNING->READY
+echo "..."
+fairmq-dds-command-ui -c s -w READY
+fairmq-dds-command-ui -c t -w "DEVICE READY"
+fairmq-dds-command-ui -c d -w IDLE
+fairmq-dds-command-ui -c q -w EXITING
+# fairmq-dds-command-ui -c q! -w EXITING
+echo "..."
+dds-info -s ${DDS_SESSION_ID} --wait-for-idle-agents ${requiredNofAgents}
+echo "------------------------"
+
+dds-topology -s ${DDS_SESSION_ID} --stop
+
+dds-agent-cmd getlog -a -s ${DDS_SESSION_ID}
+logDir="${wrkDir}/logs"
+for file in $(find "${logDir}" -name "*.tar.gz"); do tar -xf ${file} -C "${logDir}" ; done
+echo "AGENT LOG FILES IN: ${logDir}"
+
+# Cleanup function is called by EXIT trap