Java Code Examples for org.apache.rocketmq.client.exception.MQClientException#printStackTrace()

The following examples show how to use org.apache.rocketmq.client.exception.MQClientException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MQConsumerAutoConfiguration.java    From rocketmq-spring-boot-starter with Apache License 2.0 6 votes vote down vote up
private AsyncTraceDispatcher initAsyncAppender() {
    if(asyncTraceDispatcher != null) {
        return asyncTraceDispatcher;
    }
    try {
        Properties tempProperties = new Properties();
        tempProperties.put(OnsTraceConstants.MaxMsgSize, "128000");
        tempProperties.put(OnsTraceConstants.AsyncBufferSize, "2048");
        tempProperties.put(OnsTraceConstants.MaxBatchNum, "1");
        tempProperties.put(OnsTraceConstants.WakeUpNum, "1");
        tempProperties.put(OnsTraceConstants.NAMESRV_ADDR, mqProperties.getNameServerAddress());
        tempProperties.put(OnsTraceConstants.InstanceName, UUID.randomUUID().toString());
        AsyncTraceAppender asyncAppender = new AsyncTraceAppender(tempProperties);
        asyncTraceDispatcher = new AsyncTraceDispatcher(tempProperties);
        asyncTraceDispatcher.start(asyncAppender, "DEFAULT_WORKER_NAME");
    } catch (MQClientException e) {
        e.printStackTrace();
    }
    return asyncTraceDispatcher;
}
 
Example 2
Source File: RMQNormalProducer.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Override
public List<MessageQueue> getMessageQueue() {
    List<MessageQueue> mqs = null;
    try {
        mqs = producer.fetchPublishMessageQueues(topic);
    } catch (MQClientException e) {
        e.printStackTrace();
    }
    return mqs;
}
 
Example 3
Source File: RMQNormalProducer.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public void start() {
    try {
        producer.start();
        super.setStartSuccess(true);
    } catch (MQClientException e) {
        super.setStartSuccess(false);
        logger.error("producer start failed!");
        e.printStackTrace();
    }
}
 
Example 4
Source File: RocketmqMessageSubscribe.java    From framework with Apache License 2.0 5 votes vote down vote up
/**
 * Description: <br>
 * 
 * @author 王伟<br>
 * @taskId <br>
 * @param channel
 * @param subscribeChannels <br>
 */
@Override
public void onSubscribe(final String channel, final int subscribeChannels) {
    // subscribe topic and subkeys eg.[channel:subscribeChannels]
    // consumer.subscribe("TopicTest", "TagA || TagC || TagD");
    try {
        defaultMQPushConsumer.subscribe(channel, "*");
    }
    catch (MQClientException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
Example 5
Source File: RMQAsyncSendProducer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void start() {
    try {
        producer.start();
    } catch (MQClientException e) {
        logger.error("producer start failed!");
        e.printStackTrace();
    }
}
 
Example 6
Source File: RMQNormalProducer.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public void start() {
    try {
        producer.start();
        super.setStartSuccess(true);
    } catch (MQClientException e) {
        super.setStartSuccess(false);
        logger.error("producer start failed!");
        e.printStackTrace();
    }
}
 
Example 7
Source File: Consumer.java    From NetDiscovery with Apache License 2.0 5 votes vote down vote up
public void subscribe(String topic,String tag) {

        try {
            consumer.subscribe(topic, tag);

            consumer.registerMessageListener(new MessageListenerConcurrently() {

                @Override
                public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
                                                                ConsumeConcurrentlyContext context) {

                    synchronized (this) {
                        if (Preconditions.isNotBlank(msgs)) {

                            ConcurrentLinkedQueue<MessageExt> messages = map.get(topic);
                            if (Preconditions.isNotBlank(messages)) {
                                messages.addAll(msgs);
                            } else {
                                ConcurrentLinkedQueue<MessageExt> queue = new ConcurrentLinkedQueue<MessageExt>();
                                queue.addAll(msgs);
                                map.put(topic,queue);
                            }
                        }
                    }

                    return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
                }
            });

            consumer.start();
        } catch (MQClientException e) {
            e.printStackTrace();
        }

    }
 
Example 8
Source File: ClusterTestRequestProcessor.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example 9
Source File: ProducerFactory.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public static DefaultMQProducer getRMQProducer(String ns) {
    DefaultMQProducer producer = new DefaultMQProducer(RandomUtil.getStringByUUID());
    producer.setNamesrvAddr(ns);
    try {
        producer.start();
    } catch (MQClientException e) {
        e.printStackTrace();
    }

    return producer;
}
 
Example 10
Source File: RMQNormalProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public List<MessageQueue> getMessageQueue() {
    List<MessageQueue> mqs = null;
    try {
        mqs = producer.fetchPublishMessageQueues(topic);
    } catch (MQClientException e) {
        e.printStackTrace();
    }
    return mqs;
}
 
Example 11
Source File: RMQAsyncSendProducer.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
private void start() {
    try {
        producer.start();
    } catch (MQClientException e) {
        logger.error("producer start failed!");
        e.printStackTrace();
    }
}
 
Example 12
Source File: RocketmqOfflineInfoHelper.java    From netty-chat with Apache License 2.0 5 votes vote down vote up
public RocketmqOfflineInfoHelper() {
    producer = new DefaultMQProducer("send");
    producer.setNamesrvAddr("localhost:9876");
    producer.setVipChannelEnabled(false);
    try {
        producer.start();
    } catch (MQClientException e) {
        e.printStackTrace();
    }
}
 
Example 13
Source File: RMQNormalProducer.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public List<MessageQueue> getMessageQueue() {
    List<MessageQueue> mqs = null;
    try {
        mqs = producer.fetchPublishMessageQueues(topic);
    } catch (MQClientException e) {
        e.printStackTrace();
    }
    return mqs;
}
 
Example 14
Source File: ProducerFactory.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public static DefaultMQProducer getRMQProducer(String ns) {
    DefaultMQProducer producer = new DefaultMQProducer(RandomUtil.getStringByUUID());
    producer.setNamesrvAddr(ns);
    try {
        producer.start();
    } catch (MQClientException e) {
        e.printStackTrace();
    }

    return producer;
}
 
Example 15
Source File: RMQNormalConsumer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void subscribe(String topic, String subExpression) {
    try {
        consumer.subscribe(topic, subExpression);
    } catch (MQClientException e) {
        logger.error("consumer subscribe failed!");
        e.printStackTrace();
    }
}
 
Example 16
Source File: RMQNormalProducer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public List<MessageQueue> getMessageQueue() {
    List<MessageQueue> mqs = null;
    try {
        mqs = producer.fetchPublishMessageQueues(topic);
    } catch (MQClientException e) {
        e.printStackTrace();
    }
    return mqs;
}
 
Example 17
Source File: RMQNormalConsumer.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
public void create() {
    consumer = new DefaultMQPushConsumer(consumerGroup);
    consumer.setInstanceName(RandomUtil.getStringByUUID());
    consumer.setNamesrvAddr(nsAddr);
    try {
        consumer.subscribe(topic, subExpression);
    } catch (MQClientException e) {
        logger.error("consumer subscribe failed!");
        e.printStackTrace();
    }
    consumer.setMessageListener(listner);
}
 
Example 18
Source File: RMQNormalProducer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void start() {
    try {
        producer.start();
        super.setStartSuccess(true);
    } catch (MQClientException e) {
        super.setStartSuccess(false);
        logger.error("producer start failed!");
        e.printStackTrace();
    }
}
 
Example 19
Source File: RMQNormalConsumer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void start() {
    try {
        consumer.start();
        logger.info(String.format("consumer[%s] started!", consumer.getConsumerGroup()));
    } catch (MQClientException e) {
        logger.error("consumer start failed!");
        e.printStackTrace();
    }
}
 
Example 20
Source File: RMQNormalConsumer.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void create(boolean useTLS) {
    consumer = new DefaultMQPushConsumer(consumerGroup);
    consumer.setInstanceName(RandomUtil.getStringByUUID());
    consumer.setNamesrvAddr(nsAddr);
    try {
        consumer.subscribe(topic, subExpression);
    } catch (MQClientException e) {
        logger.error("consumer subscribe failed!");
        e.printStackTrace();
    }
    consumer.setMessageListener(listener);
    consumer.setUseTLS(useTLS);
}