public Void deployTopology(Topology topology, String asUser) throws Exception { TopologyContext ctx = managedTransaction.executeFunction(() -> getTopologyContext(topology, asUser)); LOG.debug("Deploying topology {}", topology); while (ctx.getState() != TopologyStates.TOPOLOGY_STATE_DEPLOYED) { managedTransaction.executeConsumer((topologyContext) -> { LOG.debug("Current state {}", topologyContext.getStateName()); topologyContext.deploy(); }, ctx); } return null; }