public static CountDownLatch getConsumerReadySignal(String streamName) {
final CountDownLatch signalAppReady = new CountDownLatch(1);
ZkClient zkClient = new ZkClient("localhost:" + CoreTestUtils.ZK_PORT);
// TODO check a proper app state variable. This is hacky
zkClient.subscribeChildChanges("/s4/streams/" + streamName + "/consumers", new IZkChildListener() {
@Override
public void handleChildChange(String parentPath, List<String> currentChilds) throws Exception {
if (currentChilds.size() == 1) {
signalAppReady.countDown();