Instead of invoking stop in case of an exception it would be cleaner to add a return value to the function and enable clock publishing only when the publisher was created successfully.