public void publish(final String topic) throws TubeClientException {
        checkServiceStatus();
        StringBuilder sBuilder = new StringBuilder(512);
        try {
            logger.info(sBuilder.append("[Publish begin 1] publish topic ")
                    .append(topic).append(", address = ")
                    .append(this.toString()).toString());
            sBuilder.delete(0, sBuilder.length());
            AtomicInteger curPubCnt = this.publishTopics.get(topic);
            if (curPubCnt == null) {
                AtomicInteger tmpPubCnt = new AtomicInteger(0);
                curPubCnt = this.publishTopics.putIfAbsent(topic, tmpPubCnt);
                if (curPubCnt == null) {
                    curPubCnt = tmpPubCnt;
                }
            }
            if (curPubCnt.incrementAndGet() == 1) {
                long curTime = System.currentTimeMillis();
                new ProducerHeartbeatTask().run();
                logger.info(sBuilder
                        .append("[Publish begin 1] already get meta info, topic: ")
                        .append(topic).append(", waste time ")
                        .append(System.currentTimeMillis() - curTime).append(" Ms").toString());
                sBuilder.delete(0, sBuilder.length());
            }
            if (topicPartitionMap.get(topic) == null) {
                throw new TubeClientException(sBuilder
                        .append("Publish topic failure, make sure the topic ")
                        .append(topic).append(" exist or acceptPublish and try later!").toString());
            }
        } finally {
            if (isStartHeart.compareAndSet(false, true)) {
                heartbeatService.scheduleWithFixedDelay(new ProducerHeartbeatTask(), 5L,
                        tubeClientConfig.getHeartbeatPeriodMs(), TimeUnit.MILLISECONDS);
            }
        }
    }
Publish a topic.

@param topic topic name
@throws TubeClientException  the exception at publish
inlong-tubemq/tubemq-client/src/main/java/org/apache/inlong/tubemq/client/producer/ProducerManager.java