为了兼容性和可读性更好,我们一般使用json字符串做为数据载体。
public void decreasecallmonitor(callmonitorinfo callmonitorinfo) throws exception { try { rabbittemplate.convertandsend( amqpconfig.data_collection_exchange, amqpconfig.callmonitor_decrease_binding, objectmapper.writevalueasstring(callmonitorinfo) ); logger.debug("enter {},message:{}", "decreasecallmonitor", callmonitorinfo.tostring()); } catch (exception ex) { logger.error("mq.decreasecallmonitor.error", ex); } }
@rabbithandler @rabbitlistener(queues = amqpconfig.customer_terminate_binding) public void customerterminate(string data) { try { terminatedto terminatedto = objectmapper.readvalue(data, terminatedto.class); customerbusinessinfomapper.updatecustomer_business_info(immutablemap.of( "status", enumcustomerstatus.terminate.getcode(), "customerid", terminatedto.getcustomerid() )); } catch (exception ex) { logger.error("解约同步异常", ex); } }
content_encoding:utf-8 content_type:text/plain
{"signsalespersonid":1001,"signsalesperson":"mq","signtime":null,"customerid":501806811767111700}
以上两点注意好,手动发布队列就没有问题了!
如对本文有疑问, 点击进行留言回复!!
nginx 配置Jenkins springboot vue swagger nacos等
网友评论