Java Code Examples for org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData#setSubVersion()
The following examples show how to use
org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData#setSubVersion() .
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: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 2
Source File: DefaultMQPullConsumerImpl.java From rocketmq with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 3
Source File: DefaultMQPullConsumerImpl.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 4
Source File: DefaultMQPullConsumerImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 5
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 6
Source File: DefaultMQPullConsumerImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 7
Source File: DefaultMQPullConsumerImpl.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 8
Source File: DefaultMQPullConsumerImpl.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Override public Set<SubscriptionData> subscriptions() { Set<SubscriptionData> result = new HashSet<SubscriptionData>(); // 获取注册的topics Set<String> topics = this.defaultMQPullConsumer.getRegisterTopics(); if (topics != null) { synchronized (topics) { for (String t : topics) { SubscriptionData ms = null; try { // 按消费组、topic构建订阅信息=》 ms = FilterAPI.buildSubscriptionData(this.groupName(), t, SubscriptionData.SUB_ALL); } catch (Exception e) { log.error("parse subscription error", e); } ms.setSubVersion(0L); result.add(ms); } } } return result; }
Example 9
Source File: DeFiConsumerManagerTest.java From DeFiBus with Apache License 2.0 | 5 votes |
private ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 10
Source File: DeFiClientManageProcessorTest.java From DeFiBus with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 11
Source File: PullMessageProcessorTest.java From rocketmq-read with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 12
Source File: DeFiPullMessageProcessorTest.java From DeFiBus with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 13
Source File: PullMessageProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 14
Source File: ConsumeQueueManagerTest.java From DeFiBus with Apache License 2.0 | 5 votes |
private static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 15
Source File: PullMessageProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 16
Source File: PullMessageProcessorTest.java From rocketmq-4.3.0 with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 17
Source File: RebalancePushImpl.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
@Override public void messageQueueChanged(String topic, Set<MessageQueue> mqAll, Set<MessageQueue> mqDivided) { /** * When rebalance result changed, should update subscription's version to notify broker. * Fix: inconsistency subscription may lead to consumer miss messages. */ SubscriptionData subscriptionData = this.subscriptionInner.get(topic); long newVersion = System.currentTimeMillis(); log.info("{} Rebalance changed, also update version: {}, {}", topic, subscriptionData.getSubVersion(), newVersion); subscriptionData.setSubVersion(newVersion); // notify broker this.getmQClientFactory().sendHeartbeatToAllBrokerWithLock(); }
Example 18
Source File: PullMessageProcessorTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 19
Source File: PullMessageProcessorTest.java From rocketmq_trans_message with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }
Example 20
Source File: PullMessageProcessorTest.java From DDMQ with Apache License 2.0 | 5 votes |
static ConsumerData createConsumerData(String group, String topic) { ConsumerData consumerData = new ConsumerData(); consumerData.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumerData.setConsumeType(ConsumeType.CONSUME_PASSIVELY); consumerData.setGroupName(group); consumerData.setMessageModel(MessageModel.CLUSTERING); Set<SubscriptionData> subscriptionDataSet = new HashSet<>(); SubscriptionData subscriptionData = new SubscriptionData(); subscriptionData.setTopic(topic); subscriptionData.setSubString("*"); subscriptionData.setSubVersion(100L); subscriptionDataSet.add(subscriptionData); consumerData.setSubscriptionDataSet(subscriptionDataSet); return consumerData; }