-
Notifications
You must be signed in to change notification settings - Fork 897
消息轨迹
Zhouxiang Zhan edited this page Feb 15, 2023
·
5 revisions
Producer 端要想使用消息轨迹,需要多配置两个配置项:
## application.properties
rocketmq.name-server=127.0.0.1:9876
rocketmq.producer.group=my-group
rocketmq.producer.enable-msg-trace=true
rocketmq.producer.customized-trace-topic=my-trace-topic
Consumer 端消息轨迹的功能需要在 @RocketMQMessageListener
中进行配置对应的属性:
@Service
@RocketMQMessageListener(
topic = "test-topic-1",
consumerGroup = "my-consumer_test-topic-1",
enableMsgTrace = true,
customizedTraceTopic = "my-trace-topic"
)
public class MyConsumer implements RocketMQListener<String> {
...
}
注意:
默认情况下 Producer 和 Consumer 的消息轨迹功能是开启的且 trace-topic 为 RMQ_SYS_TRACE_TOPIC Consumer 端的消息轨迹 trace-topic 可以在配置文件中配置
rocketmq.consumer.customized-trace-topic
配置项,不需要为在每个@RocketMQMessageListener
配置。
若需使用阿里云消息轨迹,则需要在
@RocketMQMessageListener
中将accessChannel
配置为CLOUD
。