Search in sources :

Example 1 with ClientException

use of com.aliyun.mns.common.ClientException in project xnx3 by xnx3.

the class MNSUtil method deleteQueue.

/**
 * 删除队列
 * @param queueName
 */
public void deleteQueue(String queueName) {
    try {
        // Delete Queue
        CloudQueue queue = getMNSClient().getQueueRef(queueName);
        queue.delete();
    } catch (ClientException ce) {
        clientException(ce);
    } catch (ServiceException se) {
        serviceException(se);
    } catch (Exception e) {
        exception(e);
    }
}
Also used : 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)

Example 2 with ClientException

use of com.aliyun.mns.common.ClientException 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

CloudQueue (com.aliyun.mns.client.CloudQueue)2 ClientException (com.aliyun.mns.common.ClientException)2 ServiceException (com.aliyun.mns.common.ServiceException)2 Message (com.aliyun.mns.model.Message)1