Skip to content

Commit bb4b1d4

Browse files
committed
support alibaba cloud rocketmq,format message value
1 parent a7c426c commit bb4b1d4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mse-simple-demo/C/src/main/java/com/alibabacloud/mse/demo/c/service/HelloServiceCTwoImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public String hello2(String name) {
3939
throw new RuntimeException();
4040
}
4141

42+
String mqvalue = "C" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]";
4243
String value = "C" + serviceTag + "[" + inetUtils.findFirstNonLoopbackAddress().getHostAddress() + "]" + " params:" + name;
4344
String invokerTag="";
4445
String userData = RpcContext.getContext().getAttachment("__microservice_tag__");
@@ -49,9 +50,9 @@ public String hello2(String name) {
4950
try {
5051
Message msg = new Message();
5152
msg.setTopic(topic);
52-
msg.setBody(value.getBytes(StandardCharsets.UTF_8));
53+
msg.setBody(mqvalue.getBytes(StandardCharsets.UTF_8));
5354
producer.send(msg);
54-
log.info("topic:{},messageString:{},__microservice_tag__:{}", topic, value, StringUtils.trimToNull(invokerTag));
55+
log.info("topic:{},messageString:{},__microservice_tag__:{}", topic, mqvalue, StringUtils.trimToNull(invokerTag));
5556
} catch (Exception ignore) {
5657
}
5758

0 commit comments

Comments
 (0)