org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner Java Examples
The following examples show how to use
org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner.
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: MessageUserPropIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
/** * @since version3.4.6 */ @Test public void testSendEnglishUserProp() { Message msg = MessageFactory.getRandomMessage(topic); String msgKey = "jueyinKey"; String msgValue = "jueyinValue"; msg.putUserProperty(msgKey, msgValue); RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner()); producer.send(msg, null); assertThat(producer.getAllMsgBody().size()).isEqualTo(1); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); Message sendMsg = (Message) producer.getFirstMsg(); Message recvMsg = (Message) consumer.getListner().getFirstMsg(); assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey)); }
Example #2
Source File: NormalMsgTwoSameGroupConsumerIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testStartTwoSameGroupConsumer() { int msgSize = 16; String group = initConsumerGroup(); RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*", new RMQNormalListner(group + "_1")); RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2")); TestUtils.waitForSeconds(waitTime); producer.send(msgSize); Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size()); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer2.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #3
Source File: DynamicAddConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testAddTwoConsumer() { int msgSize = 100; 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()); 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); }
Example #4
Source File: DynamicAddConsumerIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testAddTwoConsumer() { int msgSize = 100; 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()); 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); }
Example #5
Source File: DynamicCrashConsumerIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testAddTwoConsumer() { int msgSize = 100; RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner()); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner()); RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner()); MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100); asyncDefaultMQProducer.start(); 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); }
Example #6
Source File: DynamicAddAndCrashIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@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); }
Example #7
Source File: MessageUserPropIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
/** * @since version3.4.6 */ @Test public void testSendEnglishUserProp() { Message msg = MessageFactory.getRandomMessage(topic); String msgKey = "jueyinKey"; String msgValue = "jueyinValue"; msg.putUserProperty(msgKey, msgValue); RMQNormalConsumer consumer = getConsumer(nsAddr, topic, "*", new RMQNormalListner()); producer.send(msg, null); assertThat(producer.getAllMsgBody().size()).isEqualTo(1); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); Message sendMsg = (Message) producer.getFirstMsg(); Message recvMsg = (Message) consumer.getListner().getFirstMsg(); assertThat(recvMsg.getUserProperty(msgKey)).isEqualTo(sendMsg.getUserProperty(msgKey)); }
Example #8
Source File: OneConsumerMulTopicIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testConsumeWithDiffTagAndFilter() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); String tag1 = "jueyin_tag_1"; String tag2 = "jueyin_tag_2"; RMQNormalConsumer consumer = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer.subscribe(topic2, tag1); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag2)); producer.clearMsg(); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag1)); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #9
Source File: TagMessageWithSameGroupConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testConsumerStartWithInterval() { String tag = "jueyin"; int msgSize = 100; String originMsgDCName = RandomUtils.getStringByUUID(); String msgBodyDCName = RandomUtils.getStringByUUID(); RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, tag, new RMQNormalListner(originMsgDCName, msgBodyDCName)); producer.send(tag, msgSize, 100); TestUtils.waitForMonment(5); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), tag, new RMQNormalListner(originMsgDCName, msgBodyDCName)); TestUtils.waitForMonment(5); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #10
Source File: TagMessageWith1ConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@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()); }
Example #11
Source File: TagMessageWithSameGroupConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testTwoConsumerWithSameGroup() { String tag = "jueyin"; int msgSize = 20; 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); Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size()); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #12
Source File: NormalMsgTwoSameGroupConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testStartTwoSameGroupConsumer() { int msgSize = 16; String group = initConsumerGroup(); RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*", new RMQNormalListner(group + "_1")); RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2")); TestUtils.waitForSeconds(waitTime); producer.send(msgSize); Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size()); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer2.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #13
Source File: DynamicAddConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testAddOneConsumer() { int msgSize = 100; 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()); 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); }
Example #14
Source File: BroadCastTwoConsumerSubTagIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testTwoConsumerSubTag() { int msgSize = 20; String tag = "jueyin_tag"; RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, tag, new RMQNormalListner()); RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, consumer1.getConsumerGroup(), topic, tag, new RMQNormalListner()); TestUtils.waitForSeconds(waitTime); producer.send(tag, msgSize); Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size()); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer2.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #15
Source File: BroadCastNormalMsgNotRecvIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testNotConsumeAfterConsume() { int msgSize = 16; String group = initConsumerGroup(); RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*", new RMQNormalListner(group + "_1")); producer.send(msgSize); Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size()); consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer1.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner(group + "_2")); consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), waitTime); assertThat(consumer2.getListner().getAllMsgBody().size()).isEqualTo(0); }
Example #16
Source File: TagMessageWith1ConsumerIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testSubNullWithKindsOfMessage() { String tag1 = null; String tag2 = "jueyin"; String subExpress = null; 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); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #17
Source File: OneConsumerMulTopicIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testConsumeWithDiffTagAndFilter() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); String tag1 = "jueyin_tag_1"; String tag2 = "jueyin_tag_2"; RMQNormalConsumer consumer = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer.subscribe(topic2, tag1); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag2)); producer.clearMsg(); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag1)); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #18
Source File: OneConsumerMulTopicIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testConsumeWithDiffTag() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); String tag = "jueyin_tag"; RMQNormalConsumer consumer = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer.subscribe(topic2, tag); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag)); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #19
Source File: OneConsumerMulTopicIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testSynSendMessage() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); RMQNormalConsumer consumer = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer.subscribe(topic2, "*"); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize)); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #20
Source File: MulConsumerMulTopicIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testConsumeWithDiffTagAndFilter() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); String tag1 = "jueyin_tag_1"; String tag2 = "jueyin_tag_2"; RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer1.subscribe(topic2, tag1); RMQNormalConsumer consumer2 = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer2.subscribe(topic2, tag1); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag2)); producer.clearMsg(); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag1)); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListner(), consumer2.getListner()); assertThat(recvAll).isEqualTo(true); }
Example #21
Source File: TagMessageWith1ConsumerIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testSubNullWithKindsOfMessage() { String tag1 = null; String tag2 = "jueyin"; String subExpress = null; 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); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #22
Source File: MulConsumerMulTopicIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testSynSendMessage() { int msgSize = 10; String topic1 = initTopic(); String topic2 = initTopic(); RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListner()); consumer1.subscribe(topic2, "*"); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListner()); consumer2.subscribe(topic2, "*"); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize)); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListner(), consumer2.getListner()); assertThat(recvAll).isEqualTo(true); }
Example #23
Source File: DynamicCrashConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testAddTwoConsumer() { int msgSize = 100; RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQNormalListner()); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner()); RMQNormalConsumer consumer3 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic, "*", new RMQNormalListner()); MQAsyncProducer asyncDefaultMQProducer = new MQAsyncProducer(producer, msgSize, 100); asyncDefaultMQProducer.start(); 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); }
Example #24
Source File: DynamicCrashConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@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); }
Example #25
Source File: DynamicAddConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testAddTwoConsumer() { int msgSize = 100; 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()); 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); }
Example #26
Source File: DynamicAddConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testAddOneConsumer() { int msgSize = 100; 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()); 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); }
Example #27
Source File: TagMessageWith1ConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testSubTagWithKindsOfMessage() { String tag1 = null; String tag2 = "jueyin"; String subExpress = tag2; 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(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs)); }
Example #28
Source File: TagMessageWith1ConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testSubNullWithKindsOfMessage() { String tag1 = null; String tag2 = "jueyin"; String subExpress = null; 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); Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #29
Source File: TagMessageWith1ConsumerIT.java From rocketmq with Apache License 2.0 | 6 votes |
@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()); }
Example #30
Source File: MulTagSubIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testNoMatch() { String tags[] = {"jueyin1", "jueyin2", "jueyin3"}; String subExpress = "no_match"; int msgSize = 10; TagMessage tagMessage = new TagMessage(tags, topic, msgSize); RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListner()); producer.send(tagMessage.getMixedTagMessages()); Assert.assertEquals("Not all sent succeeded", msgSize * tags.length, producer.getAllUndupMsgBody().size()); TestUtils.waitForSeconds(5); assertThat(VerifyUtils .getFilterdMessage(producer.getAllMsgBody(), consumer.getListner().getAllMsgBody()) .size()).isEqualTo(0); }