org.apache.rocketmq.test.listener.rmq.concurrent.RMQDelayListner Java Examples

The following examples show how to use org.apache.rocketmq.test.listener.rmq.concurrent.RMQDelayListner. 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: NormalMsgDelayIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevell() {
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #2
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevell() {
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #3
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #4
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #5
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #6
Source File: NormalMsgDelayIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}
 
Example #7
Source File: NormalMsgDelayIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevell() {
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #8
Source File: NormalMsgDelayIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #9
Source File: NormalMsgDelayIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #10
Source File: NormalMsgDelayIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #11
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}
 
Example #12
Source File: NormalMsgDelayIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #13
Source File: NormalMsgDelayIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #14
Source File: NormalMsgDelayIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListner()).getMsgDelayTimes()));
}
 
Example #15
Source File: NormalMsgDelayIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}
 
Example #16
Source File: NormalMsgDelayIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel1() throws Exception {
    Thread.sleep(3000);
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #17
Source File: NormalMsgDelayIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #18
Source File: NormalMsgDelayIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #19
Source File: NormalMsgDelayIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #20
Source File: NormalMsgDelayIT.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}
 
Example #21
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevell() {
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #22
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #23
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #24
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #25
Source File: NormalMsgDelayIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}
 
Example #26
Source File: NormalMsgDelayIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevell() {
    int delayLevel = 1;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #27
Source File: NormalMsgDelayIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel2() {
    int delayLevel = 2;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #28
Source File: NormalMsgDelayIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel3() {
    int delayLevel = 3;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #29
Source File: NormalMsgDelayIT.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testDelayLevel4() {
    int delayLevel = 4;
    List<Object> delayMsgs = MQMessageFactory.getDelayMsg(topic, delayLevel, msgSize);
    producer.send(delayMsgs);
    Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(),
        DELAY_LEVEL[delayLevel - 1] * 1000 * 2);
    Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()));
    Assert.assertEquals("Timer is not correct", true,
        VerifyUtils.verifyDelay(DELAY_LEVEL[delayLevel - 1] * 1000,
            ((RMQDelayListner) consumer.getListener()).getMsgDelayTimes()));
}
 
Example #30
Source File: NormalMsgDelayIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    topic = initTopic();
    logger.info(String.format("use topic: %s;", topic));
    producer = getProducer(nsAddr, topic);
    consumer = getConsumer(nsAddr, topic, "*", new RMQDelayListner());
}