{"id":329626,"date":"2021-02-08T05:21:51","date_gmt":"2021-02-07T21:21:51","guid":{"rendered":"http:\/\/4563.org\/?p=329626"},"modified":"2021-02-08T05:21:51","modified_gmt":"2021-02-07T21:21:51","slug":"rabbitmq-%e5%85%b3%e4%ba%8e-routing-key-%e7%9a%84%e7%96%91%e9%97%ae","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=329626","title":{"rendered":"rabbitmq \u5173\u4e8e Routing key \u7684\u7591\u95ee"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  rabbitmq \u5173\u4e8e Routing key \u7684\u7591\u95ee               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : missz <\/span>  <span><i><\/i> 7<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<pre><code>    @RabbitListener(bindings = @QueueBinding(             value = @Queue(value = \"message\", durable = \"true\"),             exchange = @Exchange(name = \"pxm-message\") \/\/\u4ea4\u6362\u673a\u540d\u79f0\uff0cdurable \u6307\u662f\u5426\u6301\u4e45\u5316\u5230\u6570\u636e\u5e93\uff0ctype\uff1a\u6a21\u5f0f             , key = \"message.test\"     ))     @RabbitHandler     public void testMessage(Message message, Channel channel) throws Exception {         \/\/\u6d88\u8d39\u8005\u64cd\u4f5c         logger.info(\"*****messgae.test\uff0c\u5f00\u59cb\u6d88\u8d39*****\");         if (message.getBody() != null) {             String competitions = new String(message.getBody());             logger.info(\"\u6d88\u8d39\u7aef\u63a5\u6536\u5230\u6d88\u606f 1\uff1a{},{}\", competitions, message.getMessageProperties());         }         channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);      } <\/code><\/pre>\n<p>\u6309\u7167 Routing key \u7684\u89c4\u5219\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5e94\u8be5\u53ea\u4f1a\u6d88\u8d39 message.test \u4e2d\u7684\u6d88\u606f \u4f46\u662f\u8fd9\u6bb5\u4ee3\u7801\u6267\u884c\u540e\u5c06 message.test2 \u7684\u6d88\u606f\u4e5f\u6d88\u8d39\u4e86<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/02\/20210208_6021571d4b6e8.png\" alt=\"rabbitmq \u5173\u4e8e Routing key \u7684\u7591\u95ee\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5141528\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yazinnnn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e0a\u53bb\u4f60\u8fd9\u662f\u4e00\u4e2a\u961f\u5217\u5bf9\u4e00\u4ea4\u6362\u673a bind \u4e86\u4e24\u4e2a routing key<\/p>\n<p>message.test \u53ea\u662f\u4f60\u7684 routing key \u5427                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5141529\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6d88\u8d39\u662f\u57fa\u4e8e\u961f\u5217\u7684\uff0c\u548c route-key \u6ca1\u5173\u7cfb\u3002route-key \u662f\u7528\u6765\u53d1\u6d88\u606f\u7684\uff0c\u4f60\u53ea\u9700\u8981\u77e5\u9053\u4ea4\u6362\u673a\u548c route-key\uff0c\u4e0d\u9700\u8981\u77e5\u9053\u961f\u5217\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5141530\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ty916 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4ea4\u6362\u673a\u7684 type \u662f fanout \u8fd8\u662f direct                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>rabbitmq \u5173\u4e8e Routi&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/329626"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=329626"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/329626\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329626"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}