Search in sources :

Example 1 with ProducerCluter

use of rocket.ProducerCluter in project warn-report by saaavsaaa.

the class TestRocketCluter method TestSend.

@Test
public void TestSend() throws MQClientException, InterruptedException, RemotingException, MQBrokerException {
    final String producerGroup = "pg";
    final String topic = "topicTest";
    final String tag = "";
    final String key = "aaa";
    final String body = "it's body by qqq";
    List<String> addresses = new ArrayList<String>();
    addresses.add("192.168.1.44:9876");
    addresses.add("192.168.1.45:9876");
    ProducerCluter producer = new ProducerCluter(addresses, producerGroup);
    Message msg = ProducerCluter.buildMessage(topic, tag, key, body);
    boolean sendResult = producer.send(msg);
    System.out.println(sendResult);
// Thread.sleep(1000*1000);
}
Also used : ProducerCluter(rocket.ProducerCluter) Message(com.alibaba.rocketmq.common.message.Message) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Message (com.alibaba.rocketmq.common.message.Message)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 ProducerCluter (rocket.ProducerCluter)1