Search in sources :

Example 1 with Producer

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

the class TestProcess method TestSend.

// sh mqadmin updateTopic -b 192.168.3.62 -n 192.168.3.62:9876 -t 'testTopic'
@Test
public void TestSend() throws MQClientException, InterruptedException, RemotingException, MQBrokerException {
    final String address = "192.168.1.44:9876;192.168.1.45:9876";
    final String producerGroup = "pg";
    final String topic = "topicTest";
    final String tag = "";
    final String key = "aaa";
    final String body = "it's body by aaa";
    Producer producer = new Producer(address, producerGroup);
    Message msg = Producer.buildMessage(topic, tag, key, body);
    SendResult sendResult = producer.send(msg);
    System.out.println(sendResult);
}
Also used : Producer(rocket.Producer) Message(com.alibaba.rocketmq.common.message.Message) SendResult(com.alibaba.rocketmq.client.producer.SendResult) Test(org.junit.Test)

Aggregations

SendResult (com.alibaba.rocketmq.client.producer.SendResult)1 Message (com.alibaba.rocketmq.common.message.Message)1 Test (org.junit.Test)1 Producer (rocket.Producer)1