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

The following examples show how to use org.apache.rocketmq.common.protocol.heartbeat.ConsumerData. 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: PullMessageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #2
Source File: ClientManageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #3
Source File: PullMessageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #4
Source File: ClientManageProcessorTest.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #5
Source File: PullMessageProcessorTest.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #6
Source File: ClientManageProcessorTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #7
Source File: PullMessageProcessorTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #8
Source File: ClientManageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #9
Source File: PullMessageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #10
Source File: ClientManageProcessorTest.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #11
Source File: PullMessageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #12
Source File: ClientManageProcessorTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #13
Source File: PullMessageProcessorTest.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #14
Source File: ClientManageProcessorTest.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #15
Source File: PullMessageProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    brokerController.setMessageStore(messageStore);
    pullMessageProcessor = new PullMessageProcessor(brokerController);
    Channel mockChannel = mock(Channel.class);
    when(mockChannel.remoteAddress()).thenReturn(new InetSocketAddress(1024));
    when(handlerContext.channel()).thenReturn(mockChannel);
    brokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel);
    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #16
Source File: DeFiPullMessageProcessorTest.java    From DeFiBus with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    deFiBrokerController.setMessageStore(messageStore);
    deFiPullMessageProcessor = new DeFiPullMessageProcessor(deFiBrokerController);
    Channel mockChannel = mock(Channel.class);
    when(handlerContext.channel()).thenReturn(mockChannel);
    deFiBrokerController.getTopicConfigManager().getTopicConfigTable().put(topic, new TopicConfig());
    clientChannelInfo = new ClientChannelInfo(mockChannel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #17
Source File: ConsumeQueueManagerTest.java    From DeFiBus with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMinAccumulated() throws Exception {
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
    deFiBrokerController.getConsumerOffsetManager().commitOffset(clientId, group, topic, queueId, offSet);
    consumeQueueManager.setBrokerController(deFiBrokerController);
    when(messageStore.getMaxOffsetInQueue(topic, queueId)).thenReturn(1025L);
    ConsumeQueueWaterMark mark = consumeQueueManager.getMinAccumulated(topic, queueId);
    assertThat(mark).isNotNull();
    assertThat(mark.getTopic()).isEqualTo(topic);
    assertThat(mark.getConsumerGroup()).isEqualTo(group);
    assertThat(mark.getAccumulated()).isEqualTo(1);
}
 
Example #18
Source File: ClientManageProcessorTest.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Before
public void init() {
    when(handlerContext.channel()).thenReturn(channel);
    clientManageProcessor = new ClientManageProcessor(brokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    brokerController.getProducerManager().registerProducer(group, clientChannelInfo);

    ConsumerData consumerData = createConsumerData(group, topic);
    brokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}
 
Example #19
Source File: PullMessageProcessorTest.java    From rocketmq-all-4.1.0-incubating 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 #20
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;
}
 
Example #21
Source File: PullMessageProcessorTest.java    From rocketmq 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 #22
Source File: PlainAccessValidatorTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void validateHeartBeatTest() {
    HeartbeatData heartbeatData=new HeartbeatData();
    Set<ProducerData> producerDataSet=new HashSet<>();
    Set<ConsumerData> consumerDataSet=new HashSet<>();
    Set<SubscriptionData> subscriptionDataSet=new HashSet<>();
    ProducerData producerData=new ProducerData();
    producerData.setGroupName("producerGroupA");
    ConsumerData consumerData=new ConsumerData();
    consumerData.setGroupName("consumerGroupA");
    SubscriptionData subscriptionData=new SubscriptionData();
    subscriptionData.setTopic("topicC");
    producerDataSet.add(producerData);
    consumerDataSet.add(consumerData);
    subscriptionDataSet.add(subscriptionData);
    consumerData.setSubscriptionDataSet(subscriptionDataSet);
    heartbeatData.setProducerDataSet(producerDataSet);
    heartbeatData.setConsumerDataSet(consumerDataSet);
    RemotingCommand remotingCommand = RemotingCommand.createRequestCommand(RequestCode.HEART_BEAT,null);
    remotingCommand.setBody(heartbeatData.encode());
    aclClient.doBeforeRequest("", remotingCommand);
    ByteBuffer buf = remotingCommand.encode();
    buf.getInt();
    buf = ByteBuffer.allocate(buf.limit() - buf.position()).put(buf);
    buf.position(0);
    PlainAccessResource accessResource = (PlainAccessResource) plainAccessValidator.parse(RemotingCommand.decode(buf), "192.168.0.1:9876");
    plainAccessValidator.validate(accessResource);
}
 
Example #23
Source File: PullMessageProcessorTest.java    From rocketmq_trans_message 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 #24
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 #25
Source File: DeFiConsumerManagerTest.java    From DeFiBus with Apache License 2.0 5 votes vote down vote up
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 #26
Source File: ConsumeQueueManagerTest.java    From DeFiBus with Apache License 2.0 5 votes vote down vote up
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 #27
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;
}
 
Example #28
Source File: DeFiPullMessageProcessorTest.java    From DeFiBus 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 #29
Source File: PullMessageProcessorTest.java    From rocketmq 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 #30
Source File: DeFiClientManageProcessorTest.java    From DeFiBus with Apache License 2.0 5 votes vote down vote up
@Before
public void init() {
    // when(handlerContext.channel()).thenReturn(channel);
    deFiClientManageProcessor = new DeFiClientManageProcessor(deFiBrokerController);
    clientChannelInfo = new ClientChannelInfo(channel, clientId, LanguageCode.JAVA, 100);
    ConsumerData consumerData = createConsumerData(group, topic);
    deFiBrokerController.getConsumerManager().registerConsumer(
        consumerData.getGroupName(),
        clientChannelInfo,
        consumerData.getConsumeType(),
        consumerData.getMessageModel(),
        consumerData.getConsumeFromWhere(),
        consumerData.getSubscriptionDataSet(),
        false);
}