org.apache.rocketmq.test.client.mq.MQAsyncProducer Java Examples

The following examples show how to use org.apache.rocketmq.test.client.mq.MQAsyncProducer. 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: DynamicCrashConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #2
Source File: DynamicCrashConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #3
Source File: DynamicAddAndCrashIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #4
Source File: DynamicAddConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #5
Source File: DynamicAddConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #6
Source File: DynamicCrashConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #7
Source File: DynamicCrashConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #8
Source File: DynamicAddAndCrashIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #9
Source File: DynamicAddConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #10
Source File: DynamicAddConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #11
Source File: DynamicCrashConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #12
Source File: DynamicAddAndCrashIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #13
Source File: DynamicAddAndCrashIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #14
Source File: DynamicAddConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #15
Source File: DynamicAddConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #16
Source File: DynamicCrashConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #17
Source File: DynamicCrashConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #18
Source File: DynamicAddAndCrashIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #19
Source File: DynamicAddConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #20
Source File: DynamicAddConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #21
Source File: DynamicCrashConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #22
Source File: DynamicCrashConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #23
Source File: DynamicAddConsumerIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListner());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListner(), consumer2.getListner(), consumer3.getListner());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #24
Source File: DynamicAddConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #25
Source File: DynamicAddConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #26
Source File: DynamicCrashConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #27
Source File: DynamicCrashConsumerIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    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());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    consumer2.shutdown();
    consumer3.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener(), consumer3.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #28
Source File: DynamicAddAndCrashIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumerAndCrashAfterWhile() {
    int msgSize = 150;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    TestUtils.waitForSeconds(waitTime);
    consumer2.shutdown();

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #29
Source File: DynamicAddConsumerIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddOneConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);
}
 
Example #30
Source File: DynamicAddConsumerIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testAddTwoConsumer() {
    int msgSize = 100;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListener());

    MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100);
    asyncDefaultMQProducer.start();
    TestUtils.waitForSeconds(waitTime);

    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQNormalListener());

    asyncDefaultMQProducer.waitSendAll(waitTime * 6);

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

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