Search in sources :

Example 26 with MessageQueueMsg

use of org.apache.rocketmq.test.message.MessageQueueMsg in project rocketmq by apache.

the class OrderMsgBroadCastIT method testTwoConsumerSubTag.

@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;
    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*", new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);
    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());
    consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);
    consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), broadcastConsumeTime);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs())).isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs())).isEqualTo(true);
}
Also used : RMQBroadCastConsumer(org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer) RMQOrderListener(org.apache.rocketmq.test.listener.rmq.order.RMQOrderListener) MessageQueue(org.apache.rocketmq.common.message.MessageQueue) MessageQueueMsg(org.apache.rocketmq.test.message.MessageQueueMsg) Test(org.junit.Test)

Aggregations

MessageQueue (org.apache.rocketmq.common.message.MessageQueue)26 MessageQueueMsg (org.apache.rocketmq.test.message.MessageQueueMsg)26 Test (org.junit.Test)26 RMQOrderListener (org.apache.rocketmq.test.listener.rmq.order.RMQOrderListener)20 RMQNormalConsumer (org.apache.rocketmq.test.client.rmq.RMQNormalConsumer)18 RMQBroadCastConsumer (org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer)2