org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData Java Examples

The following examples show how to use org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData. 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: DefaultMQPushConsumerImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
public void subscribe(String topic, String fullClassName, String filterClassSource) throws MQClientException {
    try {
        SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
            topic, "*");
        subscriptionData.setSubString(fullClassName);
        subscriptionData.setClassFilterMode(true);
        subscriptionData.setFilterClassSource(filterClassSource);
        this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
        if (this.mQClientFactory != null) {
            this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
        }

    } catch (Exception e) {
        throw new MQClientException("subscription exception", e);
    }
}
 
Example #2
Source File: DefaultMQPullConsumerImpl.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@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 #3
Source File: FilterAPI.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public static SubscriptionData build(final String topic, final String subString,
    final String type) throws Exception {
    if (ExpressionType.TAG.equals(type) || type == null) {
        return buildSubscriptionData(null, topic, subString);
    }

    if (subString == null || subString.length() < 1) {
        throw new IllegalArgumentException("Expression can't be null! " + type);
    }

    SubscriptionData subscriptionData = new SubscriptionData();
    subscriptionData.setTopic(topic);
    subscriptionData.setSubString(subString);
    subscriptionData.setExpressionType(type);

    return subscriptionData;
}
 
Example #4
Source File: FilterAPITest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuildTagSome() {
    try {
        SubscriptionData subscriptionData = FilterAPI.build(
                "TOPIC", "A || B", ExpressionType.TAG
        );

        assertThat(subscriptionData).isNotNull();
        assertThat(subscriptionData.getTopic()).isEqualTo("TOPIC");
        assertThat(subscriptionData.getSubString()).isEqualTo("A || B");
        assertThat(ExpressionType.isTagType(subscriptionData.getExpressionType())).isTrue();

        assertThat(subscriptionData.getTagsSet()).isNotNull();
        assertThat(subscriptionData.getTagsSet()).containsExactly("A", "B");
    } catch (Exception e) {
        e.printStackTrace();
        assertThat(Boolean.FALSE).isTrue();
    }
}
 
Example #5
Source File: RebalanceImpl.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public void doRebalance(final boolean isOrder) {
    Map<String, SubscriptionData> subTable = this.getSubscriptionInner();
    if (subTable != null) {
        for (final Map.Entry<String, SubscriptionData> entry : subTable.entrySet()) {
            final String topic = entry.getKey();
            try {
                this.rebalanceByTopic(topic, isOrder);
            } catch (Throwable e) {
                if (!topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
                    log.warn("rebalanceByTopic Exception", e);
                }
            }
        }
    }

    this.truncateMessageQueueNotMyTopic();
}
 
Example #6
Source File: FilterAPITest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuildTagSome() {
    try {
        SubscriptionData subscriptionData = FilterAPI.build(
                "TOPIC", "A || B", ExpressionType.TAG
        );

        assertThat(subscriptionData).isNotNull();
        assertThat(subscriptionData.getTopic()).isEqualTo("TOPIC");
        assertThat(subscriptionData.getSubString()).isEqualTo("A || B");
        assertThat(ExpressionType.isTagType(subscriptionData.getExpressionType())).isTrue();

        assertThat(subscriptionData.getTagsSet()).isNotNull();
        assertThat(subscriptionData.getTagsSet()).containsExactly("A", "B");
    } catch (Exception e) {
        e.printStackTrace();
        assertThat(Boolean.FALSE).isTrue();
    }
}
 
Example #7
Source File: ExpressionMessageFilter.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public ExpressionMessageFilter(SubscriptionData subscriptionData, ConsumerFilterData consumerFilterData,
    ConsumerFilterManager consumerFilterManager) {
    this.subscriptionData = subscriptionData;
    this.consumerFilterData = consumerFilterData;
    this.consumerFilterManager = consumerFilterManager;
    if (consumerFilterData == null) {
        bloomDataValid = false;
        return;
    }
    BloomFilter bloomFilter = this.consumerFilterManager.getBloomFilter();
    if (bloomFilter != null && bloomFilter.isValid(consumerFilterData.getBloomFilterData())) {
        bloomDataValid = true;
    } else {
        bloomDataValid = false;
    }
}
 
Example #8
Source File: ConsumerConnectionSubCommandTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException, RemotingTimeoutException, MQClientException, RemotingSendRequestException, RemotingConnectException, MQBrokerException {
    mQClientAPIImpl = mock(MQClientAPIImpl.class);
    defaultMQAdminExt = new DefaultMQAdminExt();
    defaultMQAdminExtImpl = new DefaultMQAdminExtImpl(defaultMQAdminExt, 1000);

    Field field = DefaultMQAdminExtImpl.class.getDeclaredField("mqClientInstance");
    field.setAccessible(true);
    field.set(defaultMQAdminExtImpl, mqClientInstance);
    field = MQClientInstance.class.getDeclaredField("mQClientAPIImpl");
    field.setAccessible(true);
    field.set(mqClientInstance, mQClientAPIImpl);
    field = DefaultMQAdminExt.class.getDeclaredField("defaultMQAdminExtImpl");
    field.setAccessible(true);
    field.set(defaultMQAdminExt, defaultMQAdminExtImpl);

    ConsumerConnection consumerConnection = new ConsumerConnection();
    consumerConnection.setConsumeType(ConsumeType.CONSUME_PASSIVELY);
    consumerConnection.setMessageModel(MessageModel.CLUSTERING);
    HashSet<Connection> connections = new HashSet<>();
    connections.add(new Connection());
    consumerConnection.setConnectionSet(connections);
    consumerConnection.setSubscriptionTable(new ConcurrentHashMap<String, SubscriptionData>());
    consumerConnection.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
    when(mQClientAPIImpl.getConsumerConnectionList(anyString(), anyString(), anyLong())).thenReturn(consumerConnection);
}
 
Example #9
Source File: DefaultLitePullConsumerImpl.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public synchronized void subscribe(String topic, String subExpression) throws MQClientException {
    try {
        if (topic == null || topic.equals("")) {
            throw new IllegalArgumentException("Topic can not be null or empty.");
        }
        setSubscriptionType(SubscriptionType.SUBSCRIBE);
        SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(defaultLitePullConsumer.getConsumerGroup(),
            topic, subExpression);
        this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
        this.defaultLitePullConsumer.setMessageQueueListener(new MessageQueueListenerImpl());
        assignedMessageQueue.setRebalanceImpl(this.rebalanceImpl);
        if (serviceState == ServiceState.RUNNING) {
            this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
            updateTopicSubscribeInfoWhenSubscriptionChanged();
        }
    } catch (Exception e) {
        throw new MQClientException("subscribe exception", e);
    }
}
 
Example #10
Source File: PullMessageProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
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: DefaultMQPushConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void updateTopicSubscribeInfoWhenSubscriptionChanged() {
    Map<String, SubscriptionData> subTable = this.getSubscriptionInner();
    if (subTable != null) {
        for (final Map.Entry<String, SubscriptionData> entry : subTable.entrySet()) {
            final String topic = entry.getKey();
            this.mQClientFactory.updateTopicRouteInfoFromNameServer(topic);
        }
    }
}
 
Example #12
Source File: ConsumerManager.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public SubscriptionData findSubscriptionData(final String group, final String topic) {
    ConsumerGroupInfo consumerGroupInfo = this.getConsumerGroupInfo(group);
    if (consumerGroupInfo != null) {
        return consumerGroupInfo.findSubscriptionData(topic);
    }

    return null;
}
 
Example #13
Source File: DefaultMQPushConsumerImpl.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Override
public void updateTopicSubscribeInfo(String topic, Set<MessageQueue> info) {
    Map<String, SubscriptionData> subTable = this.getSubscriptionInner();
    if (subTable != null) {
        if (subTable.containsKey(topic)) {
            this.rebalanceImpl.topicSubscribeInfoTable.put(topic, info);
        }
    }
}
 
Example #14
Source File: DefaultMQPullConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
private void copySubscription() throws MQClientException {
    try {
        Set<String> registerTopics = this.defaultMQPullConsumer.getRegisterTopics();
        if (registerTopics != null) {
            for (final String topic : registerTopics) {
                SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
                    topic, SubscriptionData.SUB_ALL);
                this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
            }
        }
    } catch (Exception e) {
        throw new MQClientException("subscription exception", e);
    }
}
 
Example #15
Source File: ConsumerManager.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
public boolean registerConsumer(final String group, final ClientChannelInfo clientChannelInfo,
        ConsumeType consumeType, MessageModel messageModel, ConsumeFromWhere consumeFromWhere,
        final Set<SubscriptionData> subList, boolean isNotifyConsumerIdsChangedEnable) {

//        获取消费组信息
        ConsumerGroupInfo consumerGroupInfo = this.consumerTable.get(group);
        if (null == consumerGroupInfo) {
            ConsumerGroupInfo tmp = new ConsumerGroupInfo(group, consumeType, messageModel, consumeFromWhere);
            ConsumerGroupInfo prev = this.consumerTable.putIfAbsent(group, tmp);
            consumerGroupInfo = prev != null ? prev : tmp;
        }

//        更新channel信息=》
        boolean r1 =
            consumerGroupInfo.updateChannel(clientChannelInfo, consumeType, messageModel,
                consumeFromWhere);
//       更新订阅细信息=》
        boolean r2 = consumerGroupInfo.updateSubscription(subList);

        if (r1 || r2) {
            if (isNotifyConsumerIdsChangedEnable) {
//                通知消费组的所有消费者channel和订阅信息改变了=》
                this.consumerIdsChangeListener.handle(ConsumerGroupEvent.CHANGE, group, consumerGroupInfo.getAllChannel());
            }
        }

        this.consumerIdsChangeListener.handle(ConsumerGroupEvent.REGISTER, group, subList);

        return r1 || r2;
    }
 
Example #16
Source File: DefaultConsumerIdsChangeListener.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(ConsumerGroupEvent event, String group, Object... args) {
    if (event == null) {
        return;
    }
    switch (event) {
        case CHANGE:
            if (args == null || args.length < 1) {
                return;
            }
            List<Channel> channels = (List<Channel>) args[0];
            if (channels != null && brokerController.getBrokerConfig().isNotifyConsumerIdsChangedEnable()) {
                for (Channel chl : channels) {
                    this.brokerController.getBroker2Client().notifyConsumerIdsChanged(chl, group);
                }
            }
            break;
        case UNREGISTER:
            this.brokerController.getConsumerFilterManager().unRegister(group);
            break;
        case REGISTER:
            if (args == null || args.length < 1) {
                return;
            }
            Collection<SubscriptionData> subscriptionDataList = (Collection<SubscriptionData>) args[0];
            this.brokerController.getConsumerFilterManager().register(group, subscriptionDataList);
            break;
        default:
            throw new RuntimeException("Unknown event " + event);
    }
}
 
Example #17
Source File: DefaultMQPullConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public void subscriptionAutomatically(final String topic) {
    if (!this.rebalanceImpl.getSubscriptionInner().containsKey(topic)) {
        try {
            SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPullConsumer.getConsumerGroup(),
                topic, SubscriptionData.SUB_ALL);
            this.rebalanceImpl.subscriptionInner.putIfAbsent(topic, subscriptionData);
        } catch (Exception ignore) {
        }
    }
}
 
Example #18
Source File: DefaultMQPullConsumerImpl.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Override
public void updateTopicSubscribeInfo(String topic, Set<MessageQueue> info) {
    Map<String, SubscriptionData> subTable = this.rebalanceImpl.getSubscriptionInner();
    if (subTable != null) {
        if (subTable.containsKey(topic)) {
            this.rebalanceImpl.getTopicSubscribeInfoTable().put(topic, info);
        }
    }
}
 
Example #19
Source File: PullRequest.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public PullRequest(RemotingCommand requestCommand, Channel clientChannel, long timeoutMillis, long suspendTimestamp,
    long pullFromThisOffset, SubscriptionData subscriptionData) {
    this.requestCommand = requestCommand;
    this.clientChannel = clientChannel;
    this.timeoutMillis = timeoutMillis;
    this.suspendTimestamp = suspendTimestamp;
    this.pullFromThisOffset = pullFromThisOffset;
    this.subscriptionData = subscriptionData;
}
 
Example #20
Source File: DefaultMonitorListenerTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testReportConsumerRunningInfo() {
    TreeMap<String, ConsumerRunningInfo> criTable = new TreeMap<>();
    ConsumerRunningInfo consumerRunningInfo = new ConsumerRunningInfo();
    consumerRunningInfo.setSubscriptionSet(new TreeSet<SubscriptionData>());
    consumerRunningInfo.setStatusTable(new TreeMap<String, ConsumeStatus>());
    consumerRunningInfo.setSubscriptionSet(new TreeSet<SubscriptionData>());
    consumerRunningInfo.setMqTable(new TreeMap<MessageQueue, ProcessQueueInfo>());
    consumerRunningInfo.setProperties(new Properties());
    criTable.put("test", consumerRunningInfo);
    defaultMonitorListener.reportConsumerRunningInfo(criTable);
}
 
Example #21
Source File: PullRequest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
public PullRequest(RemotingCommand requestCommand, Channel clientChannel, long timeoutMillis, long suspendTimestamp,
    long pullFromThisOffset, SubscriptionData subscriptionData,
    MessageFilter messageFilter) {
    this.requestCommand = requestCommand;
    this.clientChannel = clientChannel;
    this.timeoutMillis = timeoutMillis;
    this.suspendTimestamp = suspendTimestamp;
    this.pullFromThisOffset = pullFromThisOffset;
    this.subscriptionData = subscriptionData;
    this.messageFilter = messageFilter;
}
 
Example #22
Source File: DefaultMQPushConsumerImpl.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
public void subscribe(String topic, String subExpression) throws MQClientException {
    try {
        SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(), //
            topic, subExpression);
        this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
        if (this.mQClientFactory != null) {
            this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
        }
    } catch (Exception e) {
        throw new MQClientException("subscription exception", e);
    }
}
 
Example #23
Source File: PullMessageProcessorTest.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testProcessRequest_MsgWasRemoving() throws RemotingCommandException {
    GetMessageResult getMessageResult = createGetMessageResult();
    getMessageResult.setStatus(GetMessageStatus.MESSAGE_WAS_REMOVING);
    when(messageStore.getMessage(anyString(), anyString(), anyInt(), anyLong(), anyInt(), any(SubscriptionData.class))).thenReturn(getMessageResult);

    final RemotingCommand request = createPullMsgCommand(RequestCode.PULL_MESSAGE);
    RemotingCommand response = pullMessageProcessor.processRequest(handlerContext, request);
    assertThat(response).isNotNull();
    assertThat(response.getCode()).isEqualTo(ResponseCode.PULL_RETRY_IMMEDIATELY);
}
 
Example #24
Source File: PullRequest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
public PullRequest(RemotingCommand requestCommand, Channel clientChannel, long timeoutMillis, long suspendTimestamp,
    long pullFromThisOffset, SubscriptionData subscriptionData) {
    this.requestCommand = requestCommand;
    this.clientChannel = clientChannel;
    this.timeoutMillis = timeoutMillis;
    this.suspendTimestamp = suspendTimestamp;
    this.pullFromThisOffset = pullFromThisOffset;
    this.subscriptionData = subscriptionData;
}
 
Example #25
Source File: DefaultMQPullConsumerImpl.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSubscribeTopicNeedUpdate(String topic) {
    Map<String, SubscriptionData> subTable = this.rebalanceImpl.getSubscriptionInner();
    if (subTable != null) {
        if (subTable.containsKey(topic)) {
            return !this.rebalanceImpl.topicSubscribeInfoTable.containsKey(topic);
        }
    }

    return false;
}
 
Example #26
Source File: DefaultMessageFilter.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isMatchedByConsumeQueue(Long tagsCode, ConsumeQueueExt.CqExtUnit cqExtUnit) {
    if (null == tagsCode || null == subscriptionData) {
        return true;
    }

    if (subscriptionData.isClassFilterMode()) {
        return true;
    }

    return subscriptionData.getSubString().equals(SubscriptionData.SUB_ALL)
        || subscriptionData.getCodeSet().contains(tagsCode.intValue());
}
 
Example #27
Source File: FilterAPITest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testBuildSubscriptionData() throws Exception {
    SubscriptionData subscriptionData =
            FilterAPI.buildSubscriptionData(group, topic, subString);
    assertThat(subscriptionData.getTopic()).isEqualTo(topic);
    assertThat(subscriptionData.getSubString()).isEqualTo(subString);
    String[] tags = subString.split("\\|\\|");
    Set<String> tagSet = new HashSet<String>();
    for (String tag : tags) {
        tagSet.add(tag.trim());
    }
    assertThat(subscriptionData.getTagsSet()).isEqualTo(tagSet);
}
 
Example #28
Source File: ConsumerFilterManagerTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testRegister_bySubscriptionData() {
    ConsumerFilterManager filterManager = new ConsumerFilterManager();
    List<SubscriptionData> subscriptionDatas = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        try {
            subscriptionDatas.add(
                FilterAPI.build(
                    "topic" + i,
                    "a is not null and a > " + i,
                    ExpressionType.SQL92
                )
            );
        } catch (Exception e) {
            e.printStackTrace();
            assertThat(true).isFalse();
        }
    }

    filterManager.register("CID_0", subscriptionDatas);

    Collection<ConsumerFilterData> filterDatas = filterManager.getByGroup("CID_0");

    assertThat(filterDatas).isNotNull();
    assertThat(filterDatas.size()).isEqualTo(10);

    Iterator<ConsumerFilterData> iterator = filterDatas.iterator();
    while (iterator.hasNext()) {
        ConsumerFilterData filterData = iterator.next();

        assertThat(filterData).isNotNull();
        assertThat(filterManager.getBloomFilter().isValid(filterData.getBloomFilterData())).isTrue();
    }
}
 
Example #29
Source File: FilterAPI.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
public static SubscriptionData buildSubscriptionData(final String consumerGroup, String topic,
    String subString) throws Exception {
    SubscriptionData subscriptionData = new SubscriptionData();
    subscriptionData.setTopic(topic);
    subscriptionData.setSubString(subString);

    if (null == subString || subString.equals(SubscriptionData.SUB_ALL) || subString.length() == 0) {
        subscriptionData.setSubString(SubscriptionData.SUB_ALL);
    } else {
        String[] tags = subString.split("\\|\\|");
        if (tags.length > 0) {
            for (String tag : tags) {
                if (tag.length() > 0) {
                    String trimString = tag.trim();
                    if (trimString.length() > 0) {
                        subscriptionData.getTagsSet().add(trimString);
                        subscriptionData.getCodeSet().add(trimString.hashCode());
                    }
                }
            }
        } else {
            throw new Exception("subString split error");
        }
    }

    return subscriptionData;
}
 
Example #30
Source File: PullMessageProcessorTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
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;
}