本文整理汇总了Java中org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer类的典型用法代码示例。如果您正苦于以下问题:Java RMQBroadCastConsumer类的具体用法?Java RMQBroadCastConsumer怎么用?Java RMQBroadCastConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RMQBroadCastConsumer类属于org.apache.rocketmq.test.client.rmq包,在下文中一共展示了RMQBroadCastConsumer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStartTwoSameGroupConsumer
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@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());
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:25,代码来源:NormalMsgTwoSameGroupConsumerIT.java
示例2: testStartDiffSameGroupConsumer
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testStartDiffSameGroupConsumer() {
int msgSize = 16;
String group1 = initConsumerGroup();
String group2 = initConsumerGroup();
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group1, topic, "*",
new RMQNormalListner(group1 + "_1"));
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, group2, topic, "*",
new RMQNormalListner(group2 + "_2"));
TestUtils.waitForSeconds(waitTime);
producer.send(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());
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:26,代码来源:BroadCastNormalMsgTwoDiffGroupRecvIT.java
示例3: testNotConsumeAfterConsume
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testNotConsumeAfterConsume() throws Exception {
int msgSize = 16;
String group = initConsumerGroup();
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
new RMQNormalListner(group + "_1"));
Thread.sleep(3000);
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);
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:22,代码来源:BroadCastNormalMsgNotRecvIT.java
示例4: testStartTwoConsumerAndOneConsumerFail
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testStartTwoConsumerAndOneConsumerFail() {
int msgSize = 16;
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
new RMQNormalListner());
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, "*",
new RMQNormalListner(ConsumeConcurrentlyStatus.RECONSUME_LATER));
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());
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:20,代码来源:BroadCastNormalMsgRecvFailIT.java
示例5: testTwoConsumerSubDiffTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testTwoConsumerSubDiffTag() {
int msgSize = 40;
String tag = "jueyin_tag";
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
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());
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:25,代码来源:BroadCastTwoConsumerSubDiffTagIT.java
示例6: testTwoConsumerSubTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@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());
}
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:25,代码来源:BroadCastTwoConsumerSubTagIT.java
示例7: testTwoConsumerSubTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的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);
}
示例8: testNotConsumeAfterConsume
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@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);
}
示例9: testStartTwoSameGroupConsumer
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testStartTwoSameGroupConsumer() {
int msgSize = 16;
String group = initConsumerGroup();
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
new RMQNormalListener(group + "_1"));
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
TestUtils.waitForSeconds(waitTime);
producer.send(msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
}
示例10: testStartDiffSameGroupConsumer
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testStartDiffSameGroupConsumer() {
int msgSize = 16;
String group1 = initConsumerGroup();
String group2 = initConsumerGroup();
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group1, topic, "*",
new RMQNormalListener(group1 + "_1"));
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr, group2, topic, "*",
new RMQNormalListener(group2 + "_2"));
TestUtils.waitForSeconds(waitTime);
producer.send(msgSize);
Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
}
示例11: testNotConsumeAfterConsume
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testNotConsumeAfterConsume() throws Exception {
int msgSize = 16;
String group = initConsumerGroup();
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, group, topic, "*",
new RMQNormalListener(group + "_1"));
Thread.sleep(3000);
producer.send(msgSize);
Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, "*", new RMQNormalListener(group + "_2"));
consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), waitTime);
assertThat(consumer2.getListener().getAllMsgBody().size()).isEqualTo(0);
}
示例12: testStartTwoConsumerAndOneConsumerFail
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testStartTwoConsumerAndOneConsumerFail() {
int msgSize = 16;
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
new RMQNormalListener());
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, "*",
new RMQNormalListener(ConsumeConcurrentlyStatus.RECONSUME_LATER));
producer.send(msgSize);
Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
}
示例13: testTwoConsumerSubDiffTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testTwoConsumerSubDiffTag() {
int msgSize = 40;
String tag = "jueyin_tag";
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
new RMQNormalListener());
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, tag, new RMQNormalListener());
TestUtils.waitForSeconds(waitTime);
producer.send(tag, msgSize);
Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
}
示例14: testTwoConsumerSubTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的package包/类
@Test
public void testTwoConsumerSubTag() {
int msgSize = 20;
String tag = "jueyin_tag";
RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, tag,
new RMQNormalListener());
RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
consumer1.getConsumerGroup(), topic, tag, new RMQNormalListener());
TestUtils.waitForSeconds(waitTime);
producer.send(tag, msgSize);
Assert.assertEquals("Not all sent succeeded", msgSize, producer.getAllUndupMsgBody().size());
consumer1.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
consumer2.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer1.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumer2.getListener().getAllMsgBody()))
.containsExactlyElementsIn(producer.getAllMsgBody());
}
示例15: testTwoConsumerSubTag
import org.apache.rocketmq.test.client.rmq.RMQBroadCastConsumer; //导入依赖的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);
}