Search in sources :

Example 1 with MQAsyncProducer

use of org.apache.rocketmq.test.client.mq.MQAsyncProducer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class DynamicAddAndCrashIT method testAddOneConsumerAndCrashAfterWhile.

@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);
}
Also used : RMQNormalListner(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner) RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) MQAsyncProducer(org.apache.rocketmq.test.client.mq.MQAsyncProducer) Test(org.junit.Test)

Example 2 with MQAsyncProducer

use of org.apache.rocketmq.test.client.mq.MQAsyncProducer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class DynamicCrashConsumerIT method testAddOneConsumer.

@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);
}
Also used : RMQNormalListner(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner) RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) MQAsyncProducer(org.apache.rocketmq.test.client.mq.MQAsyncProducer) Test(org.junit.Test)

Example 3 with MQAsyncProducer

use of org.apache.rocketmq.test.client.mq.MQAsyncProducer in project rocketmq by apache.

the class DynamicAddAndCrashIT method testAddTwoConsumerAndCrashAfterWhile.

@Test
public void testAddTwoConsumerAndCrashAfterWhile() {
    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());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener());
    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);
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) MQAsyncProducer(org.apache.rocketmq.test.client.mq.MQAsyncProducer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 4 with MQAsyncProducer

use of org.apache.rocketmq.test.client.mq.MQAsyncProducer in project rocketmq by apache.

the class DynamicAddConsumerIT method testAddTwoConsumer.

@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);
}
Also used : RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) MQAsyncProducer(org.apache.rocketmq.test.client.mq.MQAsyncProducer) RMQNormalListener(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener) Test(org.junit.Test)

Example 5 with MQAsyncProducer

use of org.apache.rocketmq.test.client.mq.MQAsyncProducer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.

the class DynamicAddAndCrashIT method testAddTwoConsumerAndCrashAfterWhile.

@Test
public void testAddTwoConsumerAndCrashAfterWhile() {
    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());
    RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner());
    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);
}
Also used : RMQNormalListner(org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner) RMQNormalConsumer(org.apache.rocketmq.test.client.rmq.RMQNormalConsumer) MQAsyncProducer(org.apache.rocketmq.test.client.mq.MQAsyncProducer) Test(org.junit.Test)

Aggregations

MQAsyncProducer (org.apache.rocketmq.test.client.mq.MQAsyncProducer)12 RMQNormalConsumer (org.apache.rocketmq.test.client.rmq.RMQNormalConsumer)12 Test (org.junit.Test)12 RMQNormalListener (org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListener)6 RMQNormalListner (org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner)6