本文整理汇总了Java中org.apache.rocketmq.test.message.MessageQueueMsg类的典型用法代码示例。如果您正苦于以下问题:Java MessageQueueMsg类的具体用法?Java MessageQueueMsg怎么用?Java MessageQueueMsg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageQueueMsg类属于org.apache.rocketmq.test.message包,在下文中一共展示了MessageQueueMsg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOrderMsg
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsg() {
int msgSize = 10;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListner().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
.isEqualTo(true);
}
示例2: testSendOneQueue
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testSendOneQueue() {
int msgSize = 20;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListner().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
.isEqualTo(true);
}
示例3: testSendRandomQueues
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testSendRandomQueues() {
int msgSize = 10;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(
MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListner().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
.isEqualTo(true);
}
示例4: testOrderMsgWithTagSubAll
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsgWithTagSubAll() {
int msgSize = 10;
String tag = "jueyin_tag";
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListner().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
.isEqualTo(true);
}
示例5: testOrderMsgWithTagSubTag
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsgWithTagSubTag() {
int msgSize = 5;
String tag = "jueyin_tag";
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListner().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListner()).getMsgs()))
.isEqualTo(true);
}
示例6: testTwoConsumerSubTag
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@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.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
.isEqualTo(true);
}
示例7: testOrderMsg
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsg() {
int msgSize = 10;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListener().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
.isEqualTo(true);
}
示例8: testSendOneQueue
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testSendOneQueue() {
int msgSize = 20;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(MQMessageFactory.getMessageQueues(mqs.get(0)),
msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListener().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
.isEqualTo(true);
}
示例9: testSendRandomQueues
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testSendRandomQueues() {
int msgSize = 10;
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(
MQMessageFactory.getMessageQueues(mqs.get(0), mqs.get(1), mqs.get(mqs.size() - 1)),
msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListener().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
.isEqualTo(true);
}
示例10: testOrderMsgWithTagSubAll
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsgWithTagSubAll() {
int msgSize = 10;
String tag = "jueyin_tag";
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListener().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
.isEqualTo(true);
}
示例11: testOrderMsgWithTagSubTag
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testOrderMsgWithTagSubTag() {
int msgSize = 5;
String tag = "jueyin_tag";
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, tag, new RMQOrderListener());
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize, tag);
producer.send(mqMsgs.getMsgsWithMQ());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer.getListener().getAllMsgBody()))
.containsExactlyElementsIn(mqMsgs.getMsgBodys());
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer.getListener()).getMsgs()))
.isEqualTo(true);
}
示例12: testTwoConsumerSubTag
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@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);
}
示例13: testTwoConsumersBalance
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testTwoConsumersBalance() {
int msgSize = 10;
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
"*", new RMQOrderListener());
TestUtils.waitForSeconds(waitTime);
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
consumer1.getListner(), consumer2.getListner());
assertThat(recvAll).isEqualTo(true);
boolean balance = VerifyUtils.verifyBalance(producer.getAllMsgBody().size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListner().getAllUndupMsgBody()).size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListner().getAllUndupMsgBody()).size());
assertThat(balance).isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
.isEqualTo(true);
}
示例14: testTwoConsumersBalance
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testTwoConsumersBalance() {
int msgSize = 10;
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
"*", new RMQOrderListener());
TestUtils.waitForSeconds(waitTime);
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
consumer1.getListener(), consumer2.getListener());
assertThat(recvAll).isEqualTo(true);
boolean balance = VerifyUtils.verifyBalance(producer.getAllMsgBody().size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllUndupMsgBody()).size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListener().getAllUndupMsgBody()).size());
assertThat(balance).isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs()))
.isEqualTo(true);
}
示例15: testFourConsuemrBalance
import org.apache.rocketmq.test.message.MessageQueueMsg; //导入依赖的package包/类
@Test
public void testFourConsuemrBalance() {
int msgSize = 20;
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
"*", new RMQOrderListener());
RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
"*", new RMQOrderListener());
RMQNormalConsumer consumer4 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
"*", new RMQOrderListener());
TestUtils.waitForSeconds(waitTime);
List<MessageQueue> mqs = producer.getMessageQueue();
MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
producer.send(mqMsgs.getMsgsWithMQ());
boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
consumer1.getListner(), consumer2.getListner(), consumer3.getListner(),
consumer4.getListner());
assertThat(recvAll).isEqualTo(true);
boolean balance = VerifyUtils
.verifyBalance(producer.getAllMsgBody().size(),
VerifyUtils
.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListner().getAllUndupMsgBody())
.size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListner().getAllUndupMsgBody()).size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer3.getListner().getAllUndupMsgBody()).size(),
VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer4.getListner().getAllUndupMsgBody()).size());
logger.info(String.format("consumer1:%s;consumer2:%s;consumer3:%s,consumer4:%s",
consumer1.getListner().getAllMsgBody().size(),
consumer2.getListner().getAllMsgBody().size(),
consumer3.getListner().getAllMsgBody().size(),
consumer4.getListner().getAllMsgBody().size()));
assertThat(balance).isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer3.getListner()).getMsgs()))
.isEqualTo(true);
assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer4.getListner()).getMsgs()))
.isEqualTo(true);
}