当前位置: 首页>>代码示例>>Java>>正文


Java MQClientException.printStackTrace方法代码示例

本文整理汇总了Java中com.alibaba.rocketmq.client.exception.MQClientException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java MQClientException.printStackTrace方法的具体用法?Java MQClientException.printStackTrace怎么用?Java MQClientException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.rocketmq.client.exception.MQClientException的用法示例。


在下文中一共展示了MQClientException.printStackTrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.alibaba.rocketmq.client.exception.MQClientException; //导入方法依赖的package包/类
public static void main(String[] args) throws MQClientException, InterruptedException {

        //事务决断处理类
        TransactionCheckListener transactionCheckListener = new TransactionCheckListenerImpl();
        TransactionMQProducer producer = new TransactionMQProducer("please_rename_unique_group_name");
        producer.setCheckThreadPoolMinSize(2);
        producer.setCheckThreadPoolMaxSize(2);
        producer.setCheckRequestHoldMax(2000);
        producer.setTransactionCheckListener(transactionCheckListener);
        producer.start();

        String[] tags = new String[] { "TagA", "TagB", "TagC", "TagD", "TagE" };
        TransactionExecuterImpl tranExecuter = new TransactionExecuterImpl();
        for (int i = 0; i < 100; i++) {
            try {
                Message msg =
                        new Message("TopicTest", tags[i % tags.length], "KEY" + i,
                            ("Hello RocketMQ " + i).getBytes());
                SendResult sendResult = producer.sendMessageInTransaction(msg, tranExecuter, null);
                System.out.println(sendResult);

                Thread.sleep(10);
            }
            catch (MQClientException e) {
                e.printStackTrace();
            }
        }

        for (int i = 0; i < 100000; i++) {
            Thread.sleep(1000);
        }

        producer.shutdown();

    }
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:36,代码来源:TransactionProducer.java

示例2: ClusterTestRequestProcessor

import com.alibaba.rocketmq.client.exception.MQClientException; //导入方法依赖的package包/类
public ClusterTestRequestProcessor(NamesrvController namesrvController, String productEnvName) {
    super(namesrvController);
    this.productEnvName = productEnvName;
    adminExt = new DefaultMQAdminExt();
    adminExt.setInstanceName("CLUSTER_TEST_NS_INS_" + productEnvName);
    adminExt.setUnitName(productEnvName);
    try {
        adminExt.start();
    }
    catch (MQClientException e) {
        e.printStackTrace();
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:14,代码来源:ClusterTestRequestProcessor.java


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