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

The following examples show how to use org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer#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: BroadCastNormalMsgRecvStartLaterIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 2
Source File: BroadCastNormalMsgRecvCrashIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 3
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 4
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 5
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 6
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 7
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 8
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 9
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 10
Source File: BroadCastNormalMsgRecvCrashIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 11
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 12
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 13
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 14
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListner(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}
 
Example 15
Source File: BroadCastNormalMsgRecvStartLaterIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartOneAndStartAnotherLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    producer.clearMsg();
    consumer1.clearMsg();

    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);
    producer.send(msgSize);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
}
 
Example 16
Source File: BroadCastNormalMsgRecvCrashIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartTwoAndCrashOneLater() {
    int msgSize = 16;

    String group = initConsumerGroup();
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
        new RMQNormalListener(group + "_1"));
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
    TestUtils.waitForSeconds(waitTime);

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

    consumer2.shutdown();

    producer.clearMsg();
    consumer1.clearMsg();

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

    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(producer.getAllMsgBody());

}