|
@@ -13,7 +13,6 @@ import org.apache.rocketmq.remoting.exception.RemotingException;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
@@ -32,8 +31,6 @@ public class producerTest {
|
|
|
@Autowired
|
|
|
private DefaultMQProducerExt rocketMQTemplate;
|
|
|
|
|
|
- @Value("${rocketmq.default.topic}")
|
|
|
- private String topic;
|
|
|
|
|
|
@Test
|
|
|
public void sendJsonMsg() throws UnsupportedEncodingException, InterruptedException, RemotingException, MQClientException, MQBrokerException {
|
|
@@ -42,9 +39,8 @@ public class producerTest {
|
|
|
jsonObject.put("msg", "my name is lkx");
|
|
|
Message message = new Message();
|
|
|
message.setBody(jsonObject.toJSONString().getBytes());
|
|
|
- message.setTopic(topic);
|
|
|
message.setTags("");
|
|
|
- SendResult sendResult = rocketMQTemplate.send(topic, "tag", RandomUtils.randomString(5),
|
|
|
+ SendResult sendResult = rocketMQTemplate.send("elab-rocketMQ", "tag", RandomUtils.randomString(5),
|
|
|
jsonObject.toJSONString().getBytes());
|
|
|
SendStatus sendStatus = sendResult.getSendStatus();
|
|
|
System.out.println("--->" + sendResult.toString());
|