Search in sources :

Example 1 with QueueMeta

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

the class MNSUtil method createQueue.

/**
 * 创建队列
 * @param queueName 队列的QueueName属性,同一账号同一Region下, 队列名称不能重名;必须以英文字母或者数字开头,剩余名称可以是英文,数字,横划线,长度不超过256个字符
 * @param delaySeconds 队列的DelaySeconds属性,发送消息到本队列的所有消息默认将以本参数指定的秒数延后可被消费;单位为秒,有效值范围为0-604800秒,也即0到 7天。
 * @return {@link CloudQueue}
 * 			<ul>
 * 				<li>null : 创建失败</li>
 * 				<li>不为null,返回 {@link CloudQueue}对象 : 创建成功</li>
 * 			</ul>
 */
public CloudQueue createQueue(String queueName, long delaySeconds) {
    QueueMeta qMeta = new QueueMeta();
    qMeta.setQueueName(queueName);
    qMeta.setDelaySeconds(delaySeconds);
    // use long polling when queue is empty.
    qMeta.setPollingWaitSeconds(30);
    return createQueue(qMeta);
}
Also used : QueueMeta(com.aliyun.mns.model.QueueMeta)

Example 2 with QueueMeta

use of com.aliyun.mns.model.QueueMeta in project jeesuite-libs by vakinge.

the class MNSClientInstance method createQueueIfAbsent.

public static CloudQueue createQueueIfAbsent(String queueName) {
    QueueMeta queueMeta = new QueueMeta();
    queueMeta.setQueueName(queueName);
    CloudQueue queue = getClient().getQueueRef(queueName);
    if (!queue.isQueueExist()) {
        queue.create(queueMeta);
    }
    return queue;
}
Also used : QueueMeta(com.aliyun.mns.model.QueueMeta) CloudQueue(com.aliyun.mns.client.CloudQueue)

Example 3 with QueueMeta

use of com.aliyun.mns.model.QueueMeta in project jeesuite-libs by vakinge.

the class MNSClientInstance method createQueueIfAbsent.

public static CloudQueue createQueueIfAbsent(String queueName) {
    QueueMeta queueMeta = new QueueMeta();
    queueMeta.setQueueName(queueName);
    CloudQueue queue = getClient().getQueueRef(queueName);
    if (!queue.isQueueExist()) {
        queue.create(queueMeta);
    }
    return queue;
}
Also used : QueueMeta(com.aliyun.mns.model.QueueMeta) CloudQueue(com.aliyun.mns.client.CloudQueue)

Example 4 with QueueMeta

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

the class MNSUtil method createQueue.

/**
 * 创建队列
 * @param queueName 队列的QueueName属性,同一账号同一Region下, 队列名称不能重名;必须以英文字母或者数字开头,剩余名称可以是英文,数字,横划线,长度不超过256个字符
 * @param delaySeconds 队列的DelaySeconds属性,发送消息到本队列的所有消息默认将以本参数指定的秒数延后可被消费;单位为秒,有效值范围为0-604800秒,也即0到 7天。
 * @return {@link CloudQueue}
 * 			<ul>
 * 				<li>null : 创建失败</li>
 * 				<li>不为null,返回 {@link CloudQueue}对象 : 创建成功</li>
 * 			</ul>
 */
public CloudQueue createQueue(String queueName) {
    QueueMeta qMeta = new QueueMeta();
    qMeta.setQueueName(queueName);
    return createQueue(qMeta);
}
Also used : QueueMeta(com.aliyun.mns.model.QueueMeta)

Aggregations

QueueMeta (com.aliyun.mns.model.QueueMeta)4 CloudQueue (com.aliyun.mns.client.CloudQueue)2