use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class TagMessageWith1ConsumerIT method testSubAllMessageWithTag.
@Test
public void testSubAllMessageWithTag() {
String tag = "jueyin";
String subExpress = "*";
int msgSize = 10;
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner());
producer.send(tag, msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class TagMessageWith1ConsumerIT method testSubNullWithTagNull.
@Test
public void testSubNullWithTagNull() {
String tag = null;
String subExpress = null;
int msgSize = 10;
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner());
producer.send(tag, msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class TagMessageWith1ConsumerIT method testSubAllMessageNoTag.
@Test
public void testSubAllMessageNoTag() {
String subExprress = "*";
int msgSize = 10;
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExprress, new RMQNormalListner());
producer.send(msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class TagMessageWith1ConsumerIT method testSubAllWithKindsOfMessage.
@Test
public void testSubAllWithKindsOfMessage() {
String tag1 = null;
String tag2 = "jueyin";
String subExpress = "*";
int msgSize = 10;
RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner());
List<Object> tag1Msgs = MQMessageFactory.getRMQMessage(tag1, topic, msgSize);
List<Object> tag2Msgs = MQMessageFactory.getRMQMessage(tag2, topic, msgSize);
producer.send(tag1Msgs);
producer.send(tag2Msgs);
producer.send(10);
Assert.assertEquals("Not all are sent", msgSize * 3, producer.getAllUndupMsgBody().size());
consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
use of org.apache.rocketmq.test.client.rmq.RMQNormalConsumer in project rocketmq-rocketmq-all-4.1.0-incubating by lirenzuo.
the class TagMessageWithSameGroupConsumerIT method testConsumerStartTwoAndCrashOneAfterWhile.
@Test
public void testConsumerStartTwoAndCrashOneAfterWhile() {
int msgSize = 100;
String originMsgDCName = RandomUtils.getStringByUUID();
String msgBodyDCName = RandomUtils.getStringByUUID();
RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag, new RMQNormalListner(originMsgDCName, msgBodyDCName));
RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag, new RMQNormalListner(originMsgDCName, msgBodyDCName));
producer.send(tag, msgSize, 100);
TestUtils.waitForMoment(5);
consumer2.shutdown();
mqClients.remove(1);
TestUtils.waitForMoment(5);
consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())).containsExactlyElementsIn(producer.getAllMsgBody());
}
Aggregations