Java Code Examples for org.apache.rocketmq.test.client.rmq.RMQNormalConsumer#clearMsg()

The following examples show how to use org.apache.rocketmq.test.client.rmq.RMQNormalConsumer#clearMsg() . 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: NormalMsgDynamicBalanceIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(),
        consumer2.getListener(), consumer3.getListener());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 2
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(),
        consumer2.getListener(), consumer3.getListener());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 3
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(),
        consumer2.getListener(), consumer3.getListener());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 4
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListner(),
        consumer2.getListner(), consumer3.getListner());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListner().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListner().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 5
Source File: NormalMsgDynamicBalanceIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(),
        consumer2.getListener(), consumer3.getListener());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 6
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListner(),
        consumer2.getListner(), consumer3.getListner());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListner().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListner().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 7
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListner(),
        consumer2.getListner(), consumer3.getListner());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListner().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListner().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}
 
Example 8
Source File: NormalMsgDynamicBalanceIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void test3ConsumerAndCrashOne() {
    int msgSize = 400;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);

    producer.send(msgSize);

    MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(),
        consumer2.getListener(), consumer3.getListener());
    consumer3.shutdown();
    producer.clearMsg();
    consumer1.clearMsg();
    consumer2.clearMsg();

    producer.send(msgSize);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(msgSize,
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);
}