org.apache.rocketmq.test.factory.TagMessage Java Examples

The following examples show how to use org.apache.rocketmq.test.factory.TagMessage. 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: MulTagSubIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #2
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@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 RMQNormalListener());

    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.getListener().getAllMsgBody())
        .size()).isEqualTo(0);
}
 
Example #3
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #4
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #5
Source File: MulTagSubIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #6
Source File: MulTagSubIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #7
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #8
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #9
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #10
Source File: MulTagSubIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #11
Source File: MulTagSubIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@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 RMQNormalListener());

    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.getListener().getAllMsgBody())
        .size()).isEqualTo(0);
}
 
Example #12
Source File: MulTagSubIT.java    From rocketmq-read with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #13
Source File: MulTagSubIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #14
Source File: MulTagSubIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #15
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@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 RMQNormalListener());

    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.getListener().getAllMsgBody())
        .size()).isEqualTo(0);
}
 
Example #16
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #17
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #18
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #19
Source File: MulTagSubIT.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
@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 RMQNormalListener());

    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.getListener().getAllMsgBody())
        .size()).isEqualTo(0);
}
 
Example #20
Source File: MulTagSubIT.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #21
Source File: MulTagSubIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubTwoTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
}
 
Example #22
Source File: MulTagSubIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumer = getConsumer(nsAddr, topic, subExpress,
        new RMQNormalListener());

    producer.send(tagMessage.getMixedTagMessages());
    Assert.assertEquals("Not all sent succeeded", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumer.getListener().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListener().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #23
Source File: MulTagSubIT.java    From rocketmq-4.3.0 with Apache License 2.0 6 votes vote down vote up
@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 RMQNormalListener());

    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.getListener().getAllMsgBody())
        .size()).isEqualTo(0);
}
 
Example #24
Source File: MulTagSubIT.java    From rocketmq_trans_message with Apache License 2.0 6 votes vote down vote up
@Test
public void testSubThreeTabAndMatchTwo() {
    String tags[] = {"jueyin1", "jueyin2", "jueyin3"};
    String subExpress = String.format("%s||%s", tags[0], tags[1]);
    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());

    consumer.getListner().waitForMessageConsume(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]), consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumer.getListner().getAllMsgBody())).containsExactlyElementsIn(
        tagMessage.getMessageBodyByTag(tags[0], tags[1]));
}
 
Example #25
Source File: TagMessageWithMulConsumerIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMessagesWithTwoTag() {
    String tags[] = {"jueyin1", "jueyin2"};
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, tags[0],
        new RMQNormalListener());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, tags[1],
        new RMQNormalListener());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);
    consumerTag2.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[1]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[1]));
}
 
Example #26
Source File: TagMessageWithMulConsumerIT.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testTwoConsumerOneMatchOneOtherMatchAll() {
    String tags[] = {"jueyin1", "jueyin2"};
    String sub1 = String.format("%s||%s", tags[0], tags[1]);
    String sub2 = String.format("%s|| noExist", tags[0]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, sub1,
        new RMQNormalListener());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, sub2,
        new RMQNormalListener());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags),
        consumeTime);
    consumerTag2.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
}
 
Example #27
Source File: TagMessageWithMulConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMessagesWithTwoTag() {
    String tags[] = {"jueyin1", "jueyin2"};
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, tags[0],
        new RMQNormalListner());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, tags[1],
        new RMQNormalListner());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);
    consumerTag2.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[1]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[1]));
}
 
Example #28
Source File: TagMessageWithMulConsumerIT.java    From rocketmq_trans_message with Apache License 2.0 5 votes vote down vote up
@Test
public void testTwoConsumerOneMatchOneOtherMatchAll() {
    String tags[] = {"jueyin1", "jueyin2"};
    String sub1 = String.format("%s||%s", tags[0], tags[1]);
    String sub2 = String.format("%s|| noExist", tags[0]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, sub1,
        new RMQNormalListner());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, sub2,
        new RMQNormalListner());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags),
        consumeTime);
    consumerTag2.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
}
 
Example #29
Source File: TagMessageWithMulConsumerIT.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testTwoConsumerOneMatchOneOtherMatchAll() {
    String tags[] = {"jueyin1", "jueyin2"};
    String sub1 = String.format("%s||%s", tags[0], tags[1]);
    String sub2 = String.format("%s|| noExist", tags[0]);
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, sub1,
        new RMQNormalListner());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, sub2,
        new RMQNormalListner());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags),
        consumeTime);
    consumerTag2.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListner().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
}
 
Example #30
Source File: TagMessageWithMulConsumerIT.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testSendMessagesWithTwoTag() {
    String tags[] = {"jueyin1", "jueyin2"};
    int msgSize = 10;

    TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
    RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, tags[0],
        new RMQNormalListener());
    RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, tags[1],
        new RMQNormalListener());

    List<Object> tagMsgs = tagMessage.getMixedTagMessages();
    producer.send(tagMsgs);
    Assert.assertEquals("Not all are sent", msgSize * tags.length,
        producer.getAllUndupMsgBody().size());

    consumerTag1.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
        consumeTime);
    consumerTag2.getListener().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[1]),
        consumeTime);

    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag1.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
    assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
        consumerTag2.getListener().getAllMsgBody()))
        .containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[1]));
}