.withPayload(env.getObjectMapper().writeValueAsString(payload))
.build();
final CuratorFramework curator = config.getZooKeeperConfiguration().newManagedCurator(env.lifecycle());
env.lifecycle().manage(new Managed() {
ZooKeeperServiceRegistry registry = new ZooKeeperServiceRegistry(curator, env.metrics());
@Override
public void start() throws Exception {
registry.register(endPoint);
}
@Override
public void stop() throws Exception {
registry.unregister(endPoint);
}
});
}