@Test public void testRegister() { ConsumerFilterManager filterManager = gen(10, 10); ConsumerFilterData filterData = filterManager.get("topic9", "CID_9"); assertThat(filterData).isNotNull(); assertThat(filterData.isDead()).isFalse(); assertThat(filterManager.register( "topic9", "CID_9", "a is not null", ExpressionType.SQL92, System.currentTimeMillis() + 1000 )).isTrue(); ConsumerFilterData newFilter = filterManager.get("topic9", "CID_9"); assertThat(newFilter).isNotEqualTo(filterData); assertThat(filterManager.register( "topic9", "CID_9", "a is null", ExpressionType.SQL92, newFilter.getClientVersion() )).isFalse(); ConsumerFilterData filterData1 = filterManager.get("topic9", "CID_9"); assertThat(newFilter).isEqualTo(filterData1); }
public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpressionType(), subscriptionData.getSubVersion() ); } Collection<ConsumerFilterData> groupFilterData = getByGroup(consumerGroup); Iterator<ConsumerFilterData> iterator = groupFilterData.iterator(); while (iterator.hasNext()) { ConsumerFilterData filterData = iterator.next(); boolean exist = false; for (SubscriptionData subscriptionData : subList) { if (subscriptionData.getTopic().equals(filterData.getTopic())) { exist = true; break; } } if (!exist && !filterData.isDead()) { filterData.setDeadTime(System.currentTimeMillis()); log.info("Consumer filter changed: {}, make illegal topic dead:{}", consumerGroup, filterData); } } }
ConsumerFilterManager extends ConfigManager { public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpressionType(), subscriptionData.getSubVersion() ); } Collection<ConsumerFilterData> groupFilterData = getByGroup(consumerGroup); Iterator<ConsumerFilterData> iterator = groupFilterData.iterator(); while (iterator.hasNext()) { ConsumerFilterData filterData = iterator.next(); boolean exist = false; for (SubscriptionData subscriptionData : subList) { if (subscriptionData.getTopic().equals(filterData.getTopic())) { exist = true; break; } } if (!exist && !filterData.isDead()) { filterData.setDeadTime(System.currentTimeMillis()); log.info("Consumer filter changed: {}, make illegal topic dead:{}", consumerGroup, filterData); } } } }
ConsumerFilterManager extends ConfigManager { public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpressionType(), subscriptionData.getSubVersion() ); } Collection<ConsumerFilterData> groupFilterData = getByGroup(consumerGroup); Iterator<ConsumerFilterData> iterator = groupFilterData.iterator(); while (iterator.hasNext()) { ConsumerFilterData filterData = iterator.next(); boolean exist = false; for (SubscriptionData subscriptionData : subList) { if (subscriptionData.getTopic().equals(filterData.getTopic())) { exist = true; break; } } if (!exist && !filterData.isDead()) { filterData.setDeadTime(System.currentTimeMillis()); log.info("Consumer filter changed: {}, make illegal topic dead:{}", consumerGroup, filterData); } } } ConsumerFilterManager();  ConsumerFilterManager(BrokerController brokerController); }
ConsumerFilterManager extends ConfigManager { public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpressionType(), subscriptionData.getSubVersion() ); } Collection<ConsumerFilterData> groupFilterData = getByGroup(consumerGroup); Iterator<ConsumerFilterData> iterator = groupFilterData.iterator(); while (iterator.hasNext()) { ConsumerFilterData filterData = iterator.next(); boolean exist = false; for (SubscriptionData subscriptionData : subList) { if (subscriptionData.getTopic().equals(filterData.getTopic())) { exist = true; break; } } if (!exist && !filterData.isDead()) { filterData.setDeadTime(System.currentTimeMillis()); log.info("Consumer filter changed: {}, make illegal topic dead:{}", consumerGroup, filterData); } } } ConsumerFilterManager();  ConsumerFilterManager(BrokerController brokerController); static ConsumerFilterData build(final String topic, final String consumerGroup,
        final String expression, final String type,
        final long clientVersion); void register(final String consumerGroup, final Collection<SubscriptionData> subList); boolean register(final String topic, final String consumerGroup, final String expression,
        final String type, final long clientVersion); void unRegister(final String consumerGroup); ConsumerFilterData get(final String topic, final String consumerGroup); Collection<ConsumerFilterData> getByGroup(final String consumerGroup); final Collection<ConsumerFilterData> get(final String topic); BloomFilter getBloomFilter(); @Override String encode(); @Override String configFilePath(); @Override void decode(final String jsonString); @Override String encode(final boolean prettyFormat); void clean(); ConcurrentMap<String, FilterDataMapByTopic> getFilterDataByTopic(); void setFilterDataByTopic(final ConcurrentHashMap<String, FilterDataMapByTopic> filterDataByTopic); }
ConsumerFilterManager extends ConfigManager { public void register(final String consumerGroup, final Collection<SubscriptionData> subList) { for (SubscriptionData subscriptionData : subList) { register( subscriptionData.getTopic(), consumerGroup, subscriptionData.getSubString(), subscriptionData.getExpressionType(), subscriptionData.getSubVersion() ); } Collection<ConsumerFilterData> groupFilterData = getByGroup(consumerGroup); Iterator<ConsumerFilterData> iterator = groupFilterData.iterator(); while (iterator.hasNext()) { ConsumerFilterData filterData = iterator.next(); boolean exist = false; for (SubscriptionData subscriptionData : subList) { if (subscriptionData.getTopic().equals(filterData.getTopic())) { exist = true; break; } } if (!exist && !filterData.isDead()) { filterData.setDeadTime(System.currentTimeMillis()); log.info("Consumer filter changed: {}, make illegal topic dead:{}", consumerGroup, filterData); } } } ConsumerFilterManager();  ConsumerFilterManager(BrokerController brokerController); static ConsumerFilterData build(final String topic, final String consumerGroup,
        final String expression, final String type,
        final long clientVersion); void register(final String consumerGroup, final Collection<SubscriptionData> subList); boolean register(final String topic, final String consumerGroup, final String expression,
        final String type, final long clientVersion); void unRegister(final String consumerGroup); ConsumerFilterData get(final String topic, final String consumerGroup); Collection<ConsumerFilterData> getByGroup(final String consumerGroup); final Collection<ConsumerFilterData> get(final String topic); BloomFilter getBloomFilter(); @Override String encode(); @Override String configFilePath(); @Override void decode(final String jsonString); @Override String encode(final boolean prettyFormat); void clean(); ConcurrentMap<String, FilterDataMapByTopic> getFilterDataByTopic(); void setFilterDataByTopic(final ConcurrentHashMap<String, FilterDataMapByTopic> filterDataByTopic);  }