Search in sources :

Example 6 with Message

use of com.aliyun.mns.model.Message in project xnx3 by xnx3.

the class MNSUtil method putMessage.

/**
 * 发送消息
 * @param queueName 要发送消息的队列名字
 * @param message 发送的消息对象
 * @return {@link Message}
 * 			<ul>
 * 				<li>null : 失败</li>
 * 				<li>不为null,返回 {@link Message}对象 : 成功</li>
 * 			</ul>
 */
public Message putMessage(String queueName, Message message) {
    try {
        CloudQueue queue = getMNSClient().getQueueRef(queueName);
        Message putMsg = queue.putMessage(message);
        return putMsg;
    } catch (ClientException ce) {
        clientException(ce);
    } catch (ServiceException se) {
        serviceException(se);
    } catch (Exception e) {
        exception(e);
    }
    return null;
}
Also used : Message(com.aliyun.mns.model.Message) ServiceException(com.aliyun.mns.common.ServiceException) ClientException(com.aliyun.mns.common.ClientException) ServiceException(com.aliyun.mns.common.ServiceException) ClientException(com.aliyun.mns.common.ClientException) CloudQueue(com.aliyun.mns.client.CloudQueue)

Aggregations

Message (com.aliyun.mns.model.Message)6 CloudQueue (com.aliyun.mns.client.CloudQueue)5 QueueServer (cn.cerc.db.queue.QueueServer)2 DataRow (cn.cerc.db.core.DataRow)1 ClientException (com.aliyun.mns.common.ClientException)1 ServiceException (com.aliyun.mns.common.ServiceException)1 HttpEndpoint (com.aliyun.mns.sample.HttpEndpoint)1