org.apache.rocketmq.test.factory.MQMessageFactory Java Examples
The following examples show how to use
org.apache.rocketmq.test.factory.MQMessageFactory.
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: OneConsumerMulTopicIT.java From rocketmq_trans_message 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 #2
Source File: OneConsumerMulTopicIT.java From rocketmq-read 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #3
Source File: OrderMsgIT.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@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); }
Example #4
Source File: MulConsumerMulTopicIT.java From rocketmq-read 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 RMQNormalListener()); consumer1.subscribe(topic2, tag1); RMQNormalConsumer consumer2 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); 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.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #5
Source File: MulConsumerMulTopicIT.java From rocketmq-read 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 consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); consumer1.subscribe(topic2, tag); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); consumer2.subscribe(topic2, tag); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag)); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #6
Source File: MulConsumerMulTopicIT.java From DDMQ 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 consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); consumer1.subscribe(topic2, tag); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); consumer2.subscribe(topic2, tag); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag)); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #7
Source File: MulConsumerMulTopicIT.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 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 #8
Source File: MulConsumerMulTopicIT.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 consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); consumer1.subscribe(topic2, tag); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); consumer2.subscribe(topic2, tag); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag)); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #9
Source File: MulTagSubIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testSubTwoTabAndMatchOne() { String tag1 = "jueyin1"; String tag2 = "jueyin2"; String subExpress = String.format("%s||noExistTag", tag2); int msgSize = 10; RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener()); producer.send(tag1, msgSize); Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size()); List<Object> tag2Msgs = MQMessageFactory.getRMQMessage(tag2, topic, msgSize); producer.send(tag2Msgs); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListener().waitForMessageConsume(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs)); }
Example #10
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 #11
Source File: OneConsumerMulTopicIT.java From rocketmq-all-4.1.0-incubating 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 #12
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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #13
Source File: QueryMsgByKeyIT.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testQueryMsg() { int msgSize = 20; String key = "jueyin"; long begin = System.currentTimeMillis(); List<Object> msgs = MQMessageFactory.getKeyMsg(topic, key, msgSize); producer.send(msgs); Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size()); List<MessageExt> queryMsgs = null; try { TestUtils.waitForMoment(500 * 3); queryMsgs = producer.getProducer().queryMessage(topic, key, msgSize, begin - 5000, System.currentTimeMillis() + 5000).getMessageList(); } catch (Exception e) { } assertThat(queryMsgs).isNotNull(); assertThat(queryMsgs.size()).isEqualTo(msgSize); }
Example #14
Source File: MulConsumerMulTopicIT.java From DDMQ 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 RMQNormalListener()); consumer1.subscribe(topic2, "*"); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); 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.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #15
Source File: TagMessageWith1ConsumerIT.java From DDMQ 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs)); }
Example #16
Source File: TagMessageWith1ConsumerIT.java From rocketmq-read 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs)); }
Example #17
Source File: TagMessageWith1ConsumerIT.java From rocketmq-read 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #18
Source File: MulTagSubIT.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Test public void testSubTwoTabAndMatchOne() { String tag1 = "jueyin1"; String tag2 = "jueyin2"; String subExpress = String.format("%s||noExistTag", tag2); int msgSize = 10; RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress, new RMQNormalListener()); producer.send(tag1, msgSize); Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size()); List<Object> tag2Msgs = MQMessageFactory.getRMQMessage(tag2, topic, msgSize); producer.send(tag2Msgs); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); consumer.getListener().waitForMessageConsume(MQMessageFactory.getMessageBody(tag2Msgs), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs)); }
Example #19
Source File: QueryMsgByKeyIT.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testQueryMsg() { int msgSize = 20; String key = "jueyin"; long begin = System.currentTimeMillis(); List<Object> msgs = MQMessageFactory.getKeyMsg(topic, key, msgSize); producer.send(msgs); Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size()); List<MessageExt> queryMsgs = null; try { TestUtils.waitForMoment(500 * 3); queryMsgs = producer.getProducer().queryMessage(topic, key, msgSize, begin - 5000, System.currentTimeMillis() + 5000).getMessageList(); } catch (Exception e) { } assertThat(queryMsgs).isNotNull(); assertThat(queryMsgs.size()).isEqualTo(msgSize); }
Example #20
Source File: OrderMsgIT.java From rocketmq-read with Apache License 2.0 | 6 votes |
@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); }
Example #21
Source File: OrderMsgIT.java From rocketmq-read with Apache License 2.0 | 6 votes |
@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); }
Example #22
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 #23
Source File: OneConsumerMulTopicIT.java From rocketmq-4.3.0 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #24
Source File: TagMessageWith1ConsumerIT.java From rocketmq-all-4.1.0-incubating 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 #25
Source File: OneConsumerMulTopicIT.java From rocketmq-4.3.0 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #26
Source File: MulConsumerMulTopicIT.java From rocketmq-4.3.0 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 RMQNormalListener()); consumer1.subscribe(topic2, tag1); RMQNormalConsumer consumer2 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); 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.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #27
Source File: MulConsumerMulTopicIT.java From rocketmq-4.3.0 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 consumer1 = getConsumer(nsAddr, topic1, "*", new RMQNormalListener()); consumer1.subscribe(topic2, tag); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); consumer2.subscribe(topic2, tag); producer.send(MQMessageFactory.getMsg(topic1, msgSize)); producer.send(MQMessageFactory.getMsg(topic2, msgSize, tag)); Assert.assertEquals("Not all sent succeeded", msgSize * 2, producer.getAllUndupMsgBody().size()); boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(), consumer1.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #28
Source File: MulConsumerMulTopicIT.java From rocketmq-4.3.0 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 RMQNormalListener()); consumer1.subscribe(topic2, "*"); RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic1, "*", new RMQNormalListener()); 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.getListener(), consumer2.getListener()); assertThat(recvAll).isEqualTo(true); }
Example #29
Source File: TagMessageWith1ConsumerIT.java From rocketmq-4.3.0 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 RMQNormalListener()); 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.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime); assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody())) .containsExactlyElementsIn(producer.getAllMsgBody()); }
Example #30
Source File: MulConsumerMulTopicIT.java From rocketmq_trans_message 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); }