Search in sources :

Example 1 with RocketListener

use of cn.tellwhy.third.rocketDoubleWrite.listener.RocketListener in project warn-report by saaavsaaa.

the class PushConsumerServiceImpl method run.

@Override
public void run() throws MQClientException, InterruptedException {
    System.out.println("case : PushConsumerServiceImpl start");
    RocketListener listener = new RocketListener(receive);
    DefaultMQPushConsumer consumer;
    try {
        consumer = buildPushConsumer(namesrvAddr, consumerGroup, topic, subExpression, listener);
        consumer.start();
        System.out.println("case : consumer start");
    } catch (Exception e) {
        consumer = buildPushConsumer(namesrvAddrBak, consumerGroup, topic, subExpression, listener);
        consumer.start();
        System.out.println("case : consumerbak start, reason : consumer error" + e.getMessage());
    }
}
Also used : DefaultMQPushConsumer(com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer) MQClientException(com.alibaba.rocketmq.client.exception.MQClientException) RocketListener(cn.tellwhy.third.rocketDoubleWrite.listener.RocketListener)

Aggregations

RocketListener (cn.tellwhy.third.rocketDoubleWrite.listener.RocketListener)1 DefaultMQPushConsumer (com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer)1 MQClientException (com.alibaba.rocketmq.client.exception.MQClientException)1