提交 0acbf836 编写于 作者: hebao@lab.ibiz5.com's avatar hebao@lab.ibiz5.com

推送MQ消息日志记录(log trace文件)

上级 77ca7d4a
...@@ -46,6 +46,7 @@ public class DefaultMQProducerService implements MsgProducerService{ ...@@ -46,6 +46,7 @@ public class DefaultMQProducerService implements MsgProducerService{
@Override @Override
public void sendEngineMsg(EngineMQMsg engineMQMsg) { public void sendEngineMsg(EngineMQMsg engineMQMsg) {
String msg = JSON.toJSONString(engineMQMsg); String msg = JSON.toJSONString(engineMQMsg);
log.trace(String.format("sendEngineMsg:%1$s", msg));
dstRocketMQTemplate.asyncSendOrderly(ruleEngineTopic+":Engine",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){ dstRocketMQTemplate.asyncSendOrderly(ruleEngineTopic+":Engine",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){
@Override @Override
public void onSuccess(SendResult sendResult) { public void onSuccess(SendResult sendResult) {
...@@ -64,6 +65,7 @@ public class DefaultMQProducerService implements MsgProducerService{ ...@@ -64,6 +65,7 @@ public class DefaultMQProducerService implements MsgProducerService{
@Override @Override
public void sendBuildMsg(EngineMQMsg engineMQMsg) { public void sendBuildMsg(EngineMQMsg engineMQMsg) {
String msg = JSON.toJSONString(engineMQMsg); String msg = JSON.toJSONString(engineMQMsg);
log.trace(String.format("sendBuildMsg:%1$s", msg));
dstRocketMQTemplate.asyncSendOrderly(ruleEngineTopic+":Build",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){ dstRocketMQTemplate.asyncSendOrderly(ruleEngineTopic+":Build",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){
@Override @Override
public void onSuccess(SendResult sendResult) { public void onSuccess(SendResult sendResult) {
...@@ -81,6 +83,7 @@ public class DefaultMQProducerService implements MsgProducerService{ ...@@ -81,6 +83,7 @@ public class DefaultMQProducerService implements MsgProducerService{
@Override @Override
public void sendResultsMsg(ResultsMQMsg resultsMQMsg) throws InterruptedException, RemotingException, MQClientException, MQBrokerException { public void sendResultsMsg(ResultsMQMsg resultsMQMsg) throws InterruptedException, RemotingException, MQClientException, MQBrokerException {
String msg = JSON.toJSONString(resultsMQMsg); String msg = JSON.toJSONString(resultsMQMsg);
log.trace(String.format("sendResultsMsg:%1$s", msg));
dstRocketMQTemplate.asyncSendOrderly(resultsTopic+":default",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){ dstRocketMQTemplate.asyncSendOrderly(resultsTopic+":default",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){
@Override @Override
public void onSuccess(SendResult sendResult) { public void onSuccess(SendResult sendResult) {
...@@ -98,9 +101,9 @@ public class DefaultMQProducerService implements MsgProducerService{ ...@@ -98,9 +101,9 @@ public class DefaultMQProducerService implements MsgProducerService{
@Override @Override
public void sendRuleResultsMsg(String topic, String tags, List<ExecResult> listExecResultMsg){ public void sendRuleResultsMsg(String topic, String tags, List<ExecResult> listExecResultMsg){
try { try {
String msg = JSON.toJSONString(listExecResultMsg); String msg = JSON.toJSONString(listExecResultMsg);
log.trace(String.format("sendRuleResultsMsg:%1$s", msg));
dstRocketMQTemplate.asyncSendOrderly(topic+":"+tags,msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){ dstRocketMQTemplate.asyncSendOrderly(topic+":"+tags,msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){
@Override @Override
public void onSuccess(SendResult sendResult) { public void onSuccess(SendResult sendResult) {
...@@ -113,7 +116,6 @@ public class DefaultMQProducerService implements MsgProducerService{ ...@@ -113,7 +116,6 @@ public class DefaultMQProducerService implements MsgProducerService{
} }
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("规则结果MQ主题:topic: {},tags: {},消息发送异常MQClientException: {}:", topic,tags,e); log.error("规则结果MQ主题:topic: {},tags: {},消息发送异常MQClientException: {}:", topic,tags,e);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册