Java Code Examples for org.apache.rocketmq.client.consumer.MQPullConsumerScheduleService#getDefaultMQPullConsumer()
The following examples show how to use
org.apache.rocketmq.client.consumer.MQPullConsumerScheduleService#getDefaultMQPullConsumer() .
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: PullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final String queueName, final KeyValue properties) { this.properties = properties; this.targetQueueName = queueName; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getRmqConsumerGroup(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); String accessPoints = clientConfig.getOmsAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(PropertyKeys.CONSUMER_ID, consumerId); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }
Example 2
Source File: PullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final KeyValue properties) { this.properties = properties; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getConsumerId(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) { String accessPoints = clientConfig.getAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); } this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(OMSBuiltinKeys.CONSUMER_ID, consumerId); this.rocketmqPullConsumer.setLanguage(LanguageCode.OMS); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }
Example 3
Source File: PullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final KeyValue properties) { this.properties = properties; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getConsumerId(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) { String accessPoints = clientConfig.getAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); } this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(OMSBuiltinKeys.CONSUMER_ID, consumerId); this.rocketmqPullConsumer.setLanguage(LanguageCode.OMS); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }
Example 4
Source File: PullConsumerImpl.java From DDMQ with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final String queueName, final KeyValue properties) { this.properties = properties; this.targetQueueName = queueName; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getRmqConsumerGroup(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); String accessPoints = clientConfig.getOmsAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(PropertyKeys.CONSUMER_ID, consumerId); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }
Example 5
Source File: PullConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final String queueName, final KeyValue properties) { this.properties = properties; this.targetQueueName = queueName; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getRmqConsumerGroup(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); String accessPoints = clientConfig.getOmsAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(PropertyKeys.CONSUMER_ID, consumerId); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }
Example 6
Source File: PullConsumerImpl.java From rocketmq with Apache License 2.0 | 5 votes |
public PullConsumerImpl(final KeyValue properties) { this.properties = properties; this.clientConfig = BeanUtils.populate(properties, ClientConfig.class); String consumerGroup = clientConfig.getConsumerId(); if (null == consumerGroup || consumerGroup.isEmpty()) { throw new OMSRuntimeException("-1", "Consumer Group is necessary for RocketMQ, please set it."); } pullConsumerScheduleService = new MQPullConsumerScheduleService(consumerGroup); this.rocketmqPullConsumer = pullConsumerScheduleService.getDefaultMQPullConsumer(); if ("true".equalsIgnoreCase(System.getenv("OMS_RMQ_DIRECT_NAME_SRV"))) { String accessPoints = clientConfig.getAccessPoints(); if (accessPoints == null || accessPoints.isEmpty()) { throw new OMSRuntimeException("-1", "OMS AccessPoints is null or empty."); } this.rocketmqPullConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); } this.rocketmqPullConsumer.setConsumerGroup(consumerGroup); int maxReDeliveryTimes = clientConfig.getRmqMaxRedeliveryTimes(); this.rocketmqPullConsumer.setMaxReconsumeTimes(maxReDeliveryTimes); String consumerId = OMSUtil.buildInstanceName(); this.rocketmqPullConsumer.setInstanceName(consumerId); properties.put(OMSBuiltinKeys.CONSUMER_ID, consumerId); this.rocketmqPullConsumer.setLanguage(LanguageCode.OMS); this.localMessageCache = new LocalMessageCache(this.rocketmqPullConsumer, clientConfig); }