• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java QueryResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.alibaba.rocketmq.client.QueryResult的典型用法代码示例。如果您正苦于以下问题:Java QueryResult类的具体用法?Java QueryResult怎么用?Java QueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QueryResult类属于com.alibaba.rocketmq.client包,在下文中一共展示了QueryResult类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
public static void main(String[] args) throws MQClientException, InterruptedException {
    DefaultMQProducer producer = new DefaultMQProducer("ProducerGroupName");
    producer.start();
    for (int i = 0; i < 1; i++)
        try {
            {
                Message msg = new Message("TopicTest1",// topic
                    "TagA",// tag
                    "key113",// key
                    ("Hello MetaQ").getBytes());// body
                SendResult sendResult = producer.send(msg);
                System.out.println(sendResult);

                QueryResult queryMessage =
                        producer.queryMessage("TopicTest1", "key113", 10, 0, System.currentTimeMillis());
                for (MessageExt m : queryMessage.getMessageList()) {
                    System.out.println(m);
                }
            }

        }
        catch (Exception e) {
            e.printStackTrace();
        }
    producer.shutdown();
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:27,代码来源:TestProducer.java


示例2: queryByKey

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
void queryByKey(final DefaultMQAdminExt admin, final String topic, final String key,
        final long fallbackHours) throws MQClientException, InterruptedException {
    admin.start();

    /**
     * 默认查询三天的前到现在的消息
     */
    long end = System.currentTimeMillis() - (fallbackHours * 60 * 60 * 1000);
    long begin = end - (72 * 60 * 60 * 1000);

    QueryResult queryResult = admin.queryMessage(topic, key, 32, begin, end);
    System.out.printf("%-50s %-4s  %s\n",//
        "#Message ID",//
        "#QID",//
        "#Offset");
    for (MessageExt msg : queryResult.getMessageList()) {
        System.out.printf("%-50s %-4d %d\n", msg.getMsgId(), msg.getQueueId(), msg.getQueueOffset());
    }
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:20,代码来源:QueryMsgByKeySubCommand.java


示例3: queryByKey

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
void queryByKey(final DefaultMQAdminExt admin, final String topic, final String key,
        final long fallbackHours) throws MQClientException, InterruptedException {
    admin.start();

    long end = System.currentTimeMillis() - (fallbackHours * 60 * 60 * 1000);
    long begin = end - (6 * 60 * 60 * 1000);

    QueryResult queryResult = admin.queryMessage(topic, key, 32, begin, end);
    System.out.printf("%-50s %-4s  %s\n",//
        "#Message ID",//
        "#QID",//
        "#Offset");
    for (MessageExt msg : queryResult.getMessageList()) {
        System.out.printf("%-50s %-4d %d\n", msg.getMsgId(), msg.getQueueId(), msg.getQueueOffset());
    }
}
 
开发者ID:brucechan0921,项目名称:RocketMQ-3.0.8,代码行数:17,代码来源:QueryMsgByKeySubCommand.java


示例4: queryByKey

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
void queryByKey(final DefaultMQAdminExt admin, final String topic, final String key)
        throws MQClientException, InterruptedException {
    admin.start();

    QueryResult queryResult = admin.queryMessage(topic, key, 64, 0, Long.MAX_VALUE);
    System.out.printf("%-50s %4s %40s\n",//
        "#Message ID",//
        "#QID",//
        "#Offset");
    for (MessageExt msg : queryResult.getMessageList()) {
        System.out.printf("%-50s %4d %40d\n", msg.getMsgId(), msg.getQueueId(), msg.getQueueOffset());
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:14,代码来源:QueryMsgByKeySubCommand.java


示例5: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException,
        InterruptedException {
    return this.defaultMQProducerImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQProducer.java


示例6: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.defaultMQPullConsumerImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQPullConsumer.java


示例7: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException,
        InterruptedException {
    return this.defaultMQPushConsumerImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQPushConsumer.java


示例8: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    this.makeSureStateOK();
    return this.mQClientFactory.getMQAdminImpl().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQProducerImpl.java


示例9: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.mQClientFactory.getMQAdminImpl().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:5,代码来源:DefaultMQPushConsumerImpl.java


示例10: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException,
        InterruptedException {
    return defaultMQAdminExtImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQAdminExt.java


示例11: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end) throws MQClientException,
        InterruptedException {
    return this.mqClientInstance.getMQAdminImpl().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:6,代码来源:DefaultMQAdminExtImpl.java


示例12: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return MQAdminInstance.threadLocalMQAdminExt().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:didapinchegit,项目名称:rocket-console,代码行数:6,代码来源:MQAdminExtImpl.java


示例13: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.mqClientInstance.getMQAdminImpl().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:5,代码来源:DefaultMQPushConsumerImpl.java


示例14: queryMsgByKey

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@CmdTrace(cmdClazz = QueryMsgByKeySubCommand.class)
public Table queryMsgByKey(String topicName, String msgKey, String fallbackHours) throws Throwable {
    Throwable t = null;
    DefaultMQAdminExt defaultMQAdminExt = getDefaultMQAdminExt();
    try {
        defaultMQAdminExt.start();
        long h = 0;
        if (StringUtils.isNotBlank(fallbackHours)) {
            h = Long.parseLong(fallbackHours);
        }
        long end = System.currentTimeMillis() - (h * 60 * 60 * 1000);
        long begin = end - (6 * 60 * 60 * 1000);
        QueryResult queryResult = defaultMQAdminExt.queryMessage(topicName, msgKey, 32, begin, end);

        // System.out.printf("%-50s %-4s  %s\n",//
        // "#Message ID",//
        // "#QID",//
        // "#Offset");
        String[] thead = new String[] { "#Message ID", "#QID", "#Offset" };
        int row = queryResult.getMessageList().size();
        Table table = new Table(thead, row);

        for (MessageExt msg : queryResult.getMessageList()) {
            String[] data =
                    new String[] { msg.getMsgId(), String.valueOf(msg.getQueueId()),
                                  String.valueOf(msg.getQueueOffset()) };
            table.insertTR(data);
            // System.out.printf("%-50s %-4d %d\n", msg.getMsgId(),
            // msg.getQueueId(), msg.getQueueOffset());
        }
        return table;
    }
    catch (Throwable e) {
        logger.error(e.getMessage(), e);
        t = e;
    }
    finally {
        shutdownDefaultMQAdminExt(defaultMQAdminExt);
    }
    throw t;
}
 
开发者ID:LXLun,项目名称:RocketMQMonitor,代码行数:42,代码来源:MessageService.java


示例15: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.defaultMQProducerImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQProducer.java


示例16: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.defaultMQPushConsumerImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQPushConsumer.java


示例17: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return defaultMQAdminExtImpl.queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExt.java


示例18: queryMessage

import com.alibaba.rocketmq.client.QueryResult; //导入依赖的package包/类
@Override
public QueryResult queryMessage(String topic, String key, int maxNum, long begin, long end)
        throws MQClientException, InterruptedException {
    return this.mQClientFactory.getMQAdminImpl().queryMessage(topic, key, maxNum, begin, end);
}
 
开发者ID:diwayou,项目名称:rocketmq-all-trans,代码行数:6,代码来源:DefaultMQAdminExtImpl.java



注:本文中的com.alibaba.rocketmq.client.QueryResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WeightedRandomItem类代码示例发布时间:2022-05-23
下一篇:
Java PropertyGet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap