public String create()

in src/main/java/com/aliyun/mns/client/CloudTopic.java [176:204]


    public String create(TopicMeta meta) throws ServiceException {
        CreateTopicAction action = new CreateTopicAction(serviceClient, credentials, endpoint);
        CreateTopicRequest request = new CreateTopicRequest();
        request.setRequestPath(this.topicURL);
        String topicName = getTopicName();
        if (meta == null) {
            meta = new TopicMeta();
            meta.setTopicName(topicName);
            meta.setTopicURL(this.topicURL);
            logger.debug("topic meta is null, we use default meta");
        }

        if (meta.getTopicName() == null || meta.getTopicName().trim().isEmpty()) {
            meta.setTopicName(topicName);
            meta.setTopicURL(this.topicURL);
            logger.debug("topic name in meta is null or empty, we get it from topic url");
        }

        if (!meta.getTopicName().equals(topicName)) {
            logger.warn("TopicName conflict between meta topic name and  topic url offered");
            throw new ClientException("TopicName conflict between meta topic name and  topic url offered",
                action.getUserRequestId());
        }

        request.setTopicMeta(meta);
        request.setRequestPath(MNSConstants.TOPIC_PREFIX + topicName);
        return action.executeWithCustomHeaders(request, customHeaders);

    }