use of cn.tellwhy.third.rocket.PullConsumerCluter in project warn-report by saaavsaaa.
the class TestRocketCluter method TestCatch.
@Test
public void TestCatch() throws MQClientException, RemotingException, InterruptedException, MQBrokerException {
// 336
// "192.168.1.45:9876";
final String address = "192.168.1.44:9876";
final String topic = "registerTopic";
final String consumerGroup = "cgr1";
final String subExpression = "*";
final Long offset = 0L;
List<String> addresses = new ArrayList<String>();
addresses.add("192.168.1.44:9876");
addresses.add("192.168.1.45:9876");
PullConsumerCluter consumer = new PullConsumerCluter(address, consumerGroup);
List<MessageExt> extList = consumer.getMessage(topic, offset, subExpression);
for (MessageExt ext : extList) {
String key = ext.getKeys();
String keys = ext.getProperty("KEYS");
String value = new String(ext.getBody());
System.out.println("key : " + key + "; KEYS :" + keys + "; body : " + value + "\n");
}
}
Aggregations