Search in sources :

Example 6 with CloudTopic

use of com.aliyun.mns.client.CloudTopic in project jeesuite-libs by vakinge.

the class MNSProducer method getTopic.

public CloudTopic getTopic(String topicName) {
    if (!topics.containsKey(topicName)) {
        synchronized (this) {
            if (!topics.containsKey(topicName)) {
                CloudTopic topic = MNSClientInstance.createTopicIfAbsent(topicName, null);
                topics.put(topicName, topic);
            }
        }
    }
    return topics.get(topicName);
}
Also used : CloudTopic(com.aliyun.mns.client.CloudTopic)

Example 7 with CloudTopic

use of com.aliyun.mns.client.CloudTopic in project jeesuite-libs by vakinge.

the class MNSProducer method publishMessage.

public String publishMessage(String topicName, Object data) {
    CloudTopic topic = getTopic(topicName);
    TopicMessage tMessage = new RawTopicMessage();
    tMessage.setBaseMessageBody(new MQMessage(topicName, data).toMessageValue(true));
    topic.publishMessage(tMessage);
    return tMessage.getMessageId();
}
Also used : CloudTopic(com.aliyun.mns.client.CloudTopic) RawTopicMessage(com.aliyun.mns.model.RawTopicMessage) TopicMessage(com.aliyun.mns.model.TopicMessage) RawTopicMessage(com.aliyun.mns.model.RawTopicMessage) MQMessage(com.jeesuite.amqp.MQMessage)

Example 8 with CloudTopic

use of com.aliyun.mns.client.CloudTopic in project jeesuite-libs by vakinge.

the class MNSProducer method getTopic.

public CloudTopic getTopic(String topicName) {
    if (!topics.containsKey(topicName)) {
        synchronized (this) {
            if (!topics.containsKey(topicName)) {
                CloudTopic topic = MNSClientInstance.createTopicIfAbsent(topicName, null);
                topics.put(topicName, topic);
            }
        }
    }
    return topics.get(topicName);
}
Also used : CloudTopic(com.aliyun.mns.client.CloudTopic)

Aggregations

CloudTopic (com.aliyun.mns.client.CloudTopic)8 ServiceException (com.aliyun.mns.common.ServiceException)4 TopicMeta (com.aliyun.mns.model.TopicMeta)3 ClientException (com.aliyun.mns.common.ClientException)2 RawTopicMessage (com.aliyun.mns.model.RawTopicMessage)2 SubscriptionMeta (com.aliyun.mns.model.SubscriptionMeta)2 TopicMessage (com.aliyun.mns.model.TopicMessage)2 MQMessage (com.jeesuite.amqp.MQMessage)1 MQMessage (com.mendmix.amqp.MQMessage)1 BaseVO (com.xnx3.BaseVO)1