{"id":550,"date":"2024-09-13T00:53:40","date_gmt":"2024-09-12T16:53:40","guid":{"rendered":"https:\/\/forelink.top\/?p=550"},"modified":"2024-09-13T00:57:31","modified_gmt":"2024-09-12T16:57:31","slug":"rabbitmq%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/forelink.top\/index.php\/2024\/09\/13\/rabbitmq%e7%ae%80%e4%bb%8b\/","title":{"rendered":"RabbitMQ\u7b80\u4ecb"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"amqp\u534f\u8bae\">AMQP\u534f\u8bae<\/h1>\n\n\n\n<p>AMQP, \u5373 Advanced Message Queuing Protocol \uff08\u9ad8\u7ea7\u6d88\u606f\u961f\u5217\u534f\u8bae\uff09\n\u662f2006\u5e74\u53d1\u5e03\u7684<strong>\u7f51\u7edc\u534f\u8bae<\/strong>\uff0c\u662f\u5e94\u7528\u5c42\u534f\u8bae\u7684\u4e00\u4e2a\u5f00\u653e\u6807\u51c6\uff0c\u4e3a\u9762\u5411\u6d88\u606f\u7684\u4e2d\u95f4\u4ef6\u8bbe\u8ba1\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"rabbitmq\">RabbitMQ<\/h1>\n\n\n\n<p>2007\u5e74\uff0cRabbit \u6280\u672f\u516c\u53f8\u57fa\u4e8e AMQP \u6807\u51c6\u5f00\u53d1\u4e86 RabbitMQ 1.0\u3002\nRabbitMQ \u91c7\u7528 Erlang \u8bed\u8a00\u5f00\u53d1\uff0cErlang \u662f\u4e13\u95e8\u4e3a\u5f00\u53d1\u9ad8\u5e76\u53d1\u548c\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u8bed\u8a00\uff0c\u5728\u7535\u4fe1\u9886\u57df\u4f7f\u7528\u5e7f\u6cdb\u3002<\/p>\n\n\n\n<p>RabbitMQ \u57fa\u7840\u67b6\u6784\u5982\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/forelink-picgo.oss-cn-beijing.aliyuncs.com\/img\/20240912204840.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/forelink-picgo.oss-cn-beijing.aliyuncs.com\/img\/20240912204840.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image.png\"\/><\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Broker<\/strong> \uff1a \u63a5\u6536\u548c\u5206\u53d1\u6d88\u606f\u7684\u5e94\u7528\uff0c\u5168\u79f0Message Broker\uff0cRabbitMQ Server \u5c31\u662f Message Broker <\/p>\n\n\n\n<p><strong>Virtual<\/strong> <strong>host<\/strong> \uff1a \u51fa\u4e8e\u591a\u79df\u6237\u548c\u5b89\u5168\u56e0\u7d20\u8bbe\u8ba1\uff0c\u628a AMQP \u7684\u57fa\u672c\u7ec4\u4ef6\u5212\u5206\u5230\u4e00\u4e2a\u865a\u62df\u7684\u5206\u7ec4\u4e2d\uff0c\u7c7b\u4f3c\u4e8e namepsace\uff08\u547d\u540d\u7a7a\u95f4\uff09\u7684\u6982\u5ff5\u3002\u5f53\u591a\u4e2a\u7528\u6237\u4f7f\u7528\u4e0d\u540c\u670d\u52a1\u65f6\uff0c\u5212\u5206\u51fa\u591a\u4e2avhost\uff0c\u6bcf\u4e2a\u7528\u6237\u5728\u81ea\u5df1\u7684vhost\u521b\u5efa Exchange \/ Queue <\/p>\n\n\n\n<p><strong>Connection<\/strong> \uff1a Producer \/ Consumer \u548c Broker \u4e4b\u95f4\u7684 TCP\u8fde\u63a5 <\/p>\n\n\n\n<p><strong>Channel<\/strong> \uff1a \u5982\u679c\u6bcf\u4e00\u6b21\u8bbf\u95ee RabbitMQ \u90fd\u5efa\u7acb\u4e00\u4e2a Connection\uff0c\u5728\u6d88\u606f\u91cf\u5927\u65f6\u5efa\u7acb TCP Connection\u7684\u5f00\u9500\u5c06\u662f\u5de8\u5927\u7684\uff0c\u6548\u7387\u4e5f\u8f83\u4f4e\u3002Channel \u662f\u5728 Connection \u5185\u90e8\u5efa\u7acb\u7684\u903b\u8f91\u8fde\u63a5\uff0c\u5982\u679c\u5e94\u7528\u7a0b\u5e8f\u652f\u6301\u591a\u7ebf\u7a0b\uff0c\u901a\u5e38\u6bcf\u4e2a\u7ebf\u7a0b\u521b\u5efa\u5355\u72ec\u7684 Channel \u8fdb\u884c\u901a\u8baf\uff0cAMQP method \u5305\u542b\u4e86channel id \u5e2e\u52a9\u5ba2\u6237\u7aef\u548c Message broker \u8bc6\u522b Channel\uff0c\u6240\u4ee5 channel \u4e4b\u95f4\u662f\u5b8c\u5168\u9694\u79bb\u7684\u3002Channel \u4f5c\u4e3a\u8f7b\u91cf\u7ea7\u7684\u8fde\u63a5\uff0c\u6781\u5927\u51cf\u5c11\u4e86\u64cd\u4f5c\u7cfb\u7edf\u5efa\u7acb TCP Connection \u7684\u5f00\u9500 <\/p>\n\n\n\n<p><strong>Exchange<\/strong> \uff1a message \u5230\u8fbe broker \u7684\u7b2c\u4e00\u7ad9\uff0c\u6839\u636e\u5206\u53d1\u89c4\u5219\uff0c\u5339\u914d\u67e5\u8be2\u8868\u4e2d\u7684 routing key\uff0c\u5206\u53d1\u6d88\u606f\u5230 queue \u4e2d\u53bb\u3002\u5e38\u7528\u7684\u7c7b\u578b\u6709\uff1adirect\uff08point-to-point\uff09topic\uff08publish-subscribe\uff09fanout\uff08multicast\uff09 <\/p>\n\n\n\n<p><strong>Queue<\/strong> \uff1a message \u5230\u8fbe\u6b64\u5904\uff0c\u7b49\u5f85\u88abConsumer\u53d6\u8d70 <\/p>\n\n\n\n<p><strong>Binding<\/strong> \uff1a exchange \u548c queue \u4e4b\u95f4\u7684\u865a\u62df\u8fde\u63a5\uff0cBinding \u4e2d\u53ef\u4ee5\u5305\u542b routing key\u3002Binding \u4fe1\u606f\u88ab\u4fdd\u5b58\u5230 exchange \u4e2d\u7684\u67e5\u8be2\u8868\u4e2d\uff0c\u7528\u4e8e message \u7684\u5206\u53d1\u4f9d\u636e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"rabbitmq-\u5de5\u4f5c\u6a21\u5f0f\">RabbitMQ \u5de5\u4f5c\u6a21\u5f0f<\/h2>\n\n\n\n<p>RabbitMQ \u63d0\u4f9b\u4e86 6\u79cd\u5de5\u4f5c\u6a21\u5f0f\uff1a\n\u7b80\u5355\u6a21\u5f0f \nwork queues \nPublish\/Subscribe \nRouting \nTopics \nRPC<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"jms\">JMS<\/h2>\n\n\n\n<p>RabbitMQ \u5b98\u65b9\u6ca1\u6709\u63d0\u4f9b JMS \u7684\u5b9e\u73b0\u5305\uff0c \u5f00\u6e90\u793e\u533a\u6709\u63d0\u4f9b\u3002\nJMS \u5373 Java \u6d88\u606f\u670d\u52a1\uff08JavaMessage Service\uff09 \u5e94\u7528\u7a0b\u5e8f\u63a5\u53e3\uff0c\u662f\u4e00\u4e2a Java \u5e73\u53f0\u4e2d\u5173\u4e8e\u9762\u5411\u6d88\u606f\u4e2d\u95f4\u4ef6\u7684API\nJMS \u662f JavaEE \u89c4\u8303\u4e2d\u7684\u4e00\u79cd\uff0c\u7c7b\u6bd4JDBC\n\u5c3d\u7ba1RabbitMQ\u6ca1\u6709\uff0c\u5f88\u591a\u6d88\u606f\u4e2d\u95f4\u4ef6\u90fd\u5b9e\u73b0\u4e86JMS\u89c4\u8303\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AMQP\u534f\u8bae AMQP, \u5373 Advanced Message Queuing Protocol \uff08\u9ad8\u7ea7\u6d88\u606f\u961f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[48,17],"tags":[],"class_list":["post-550","post","type-post","status-publish","format-standard","hentry","category-rabbitmq","category-17"],"_links":{"self":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/comments?post=550"}],"version-history":[{"count":2,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/550\/revisions"}],"predecessor-version":[{"id":553,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/posts\/550\/revisions\/553"}],"wp:attachment":[{"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/media?parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/categories?post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/forelink.top\/index.php\/wp-json\/wp\/v2\/tags?post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}