{"id":62108,"date":"2026-01-19T10:57:48","date_gmt":"2026-01-19T02:57:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/62108.html"},"modified":"2026-01-19T10:57:48","modified_gmt":"2026-01-19T02:57:48","slug":"rabbitmq%e5%bf%ab%e9%80%9f%e4%b8%8a%e6%89%8b%e4%b8%8e%e6%a0%b8%e5%bf%83%e6%a6%82%e5%bf%b5%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/62108.html","title":{"rendered":"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3"},"content":{"rendered":"<h3>\u4e00\u3001\u4ec0\u4e48\u662fMQ&#xff1f;\u6211\u4eec\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f;<\/h3>\n<h4>1.1 MQ\u7684\u5b9a\u4e49\u4e0e\u4f5c\u7528<\/h4>\n<p>MQ&#xff08;Message Queue&#xff0c;\u6d88\u606f\u961f\u5217&#xff09;\u00a0\u662f\u4e00\u79cd\u5728\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u7684\u4e2d\u95f4\u4ef6\u3002\u5b83\u7531\u4e24\u90e8\u5206\u7ec4\u6210&#xff1a;<\/p>\n<ul>\n<li>\n<p>Message&#xff08;\u6d88\u606f&#xff09;&#xff1a;\u5728\u4e0d\u540c\u5e94\u7528\u95f4\u4f20\u9012\u7684\u6570\u636e\u8f7d\u4f53<\/p>\n<\/li>\n<li>\n<p>Queue&#xff08;\u961f\u5217&#xff09;&#xff1a;\u9075\u5faaFIFO&#xff08;\u5148\u8fdb\u5148\u51fa&#xff09;\u539f\u5219\u7684\u6570\u636e\u7ed3\u6784<\/p>\n<\/li>\n<\/ul>\n<p>MQ\u7684\u6838\u5fc3\u4f5c\u7528\u662f\u5c06\u540c\u6b65\u7684\u4e8b\u4ef6\u9a71\u52a8\u8f6c\u53d8\u4e3a\u5f02\u6b65\u7684\u6d88\u606f\u9a71\u52a8\u3002\u4e3e\u4e2a\u7b80\u5355\u4f8b\u5b50&#xff1a;Spring Boot\u5185\u90e8\u5c31\u6709\u4e00\u5957\u4e8b\u4ef6\u76d1\u542c\u673a\u5236&#xff0c;ApplicationContext\u53d1\u5e03\u4e8b\u4ef6&#xff0c;\u76d1\u542c\u5668\u6d88\u8d39\u4e8b\u4ef6\u3002\u4f46\u8fd9\u79cd\u673a\u5236\u4ec5\u9650\u4e8e\u5355\u8fdb\u7a0b\u5185\u90e8&#xff0c;\u800cMQ\u5219\u80fd\u8ba9\u8fd9\u5957\u673a\u5236\u8de8\u8fdb\u7a0b\u3001\u8de8\u670d\u52a1\u3001\u751a\u81f3\u8de8\u8bed\u8a00\u8fd0\u884c\u3002<\/p>\n<h4>1.2 MQ\u5e26\u6765\u7684\u4e09\u5927\u597d\u5904<\/h4>\n<li>\n<p>\u89e3\u8026&#xff1a;\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005\u53ea\u4e0eMQ\u4ea4\u4e92&#xff0c;\u5f7c\u6b64\u65e0\u9700\u77e5\u9053\u5bf9\u65b9\u7684\u5b58\u5728<\/p>\n<\/li>\n<li>\n<p>\u5f02\u6b65&#xff1a;\u6d88\u606f\u53ef\u6682\u5b58\u4e8eMQ\u4e2d&#xff0c;\u6d88\u8d39\u8005\u53ef\u5728\u4efb\u610f\u65f6\u95f4\u5904\u7406<\/p>\n<\/li>\n<li>\n<p>\u524a\u5cf0\u586b\u8c37&#xff1a;\u7f13\u51b2\u751f\u4ea7\u4e0e\u6d88\u8d39\u901f\u5ea6\u4e0d\u5339\u914d\u5e26\u6765\u7684\u538b\u529b<\/p>\n<\/li>\n<h4>1.3 \u4e3b\u6d41MQ\u4ea7\u54c1\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u4ea7\u54c1\u4f18\u70b9\u7f3a\u70b9\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>Kafka<\/td>\n<td>\u541e\u5410\u91cf\u6781\u5927&#xff0c;\u751f\u6001\u5b8c\u6574<\/td>\n<td>\u529f\u80fd\u76f8\u5bf9\u5355\u4e00<\/td>\n<td>\u65e5\u5fd7\u6536\u96c6\u3001\u5927\u6570\u636e\u6d41\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>RabbitMQ<\/td>\n<td>\u6d88\u606f\u53ef\u9760&#xff0c;\u529f\u80fd\u5168\u9762<\/td>\n<td>\u541e\u5410\u91cf\u8f83\u4f4e&#xff0c;Erlang\u8bed\u8a00\u5c0f\u4f17<\/td>\n<td>\u4f01\u4e1a\u5185\u90e8\u7cfb\u7edf\u3001\u4e1a\u52a1\u89e3\u8026<\/td>\n<\/tr>\n<tr>\n<td>RocketMQ<\/td>\n<td>\u4e09\u9ad8&#xff08;\u9ad8\u541e\u5410\u3001\u9ad8\u6027\u80fd\u3001\u9ad8\u53ef\u7528&#xff09;&#xff0c;\u529f\u80fd\u4e30\u5bcc<\/td>\n<td>\u751f\u6001\u76f8\u5bf9\u8f83\u5f31<\/td>\n<td>\u5168\u573a\u666f&#xff0c;\u5c24\u5176\u91d1\u878d\u7ea7\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>Pulsar&#xff08;\u65b0\u5174&#xff09;<\/td>\n<td>\u9002\u5408\u6d77\u91cf\u7cfb\u7edf\u8c03\u7528&#xff0c;\u7ade\u4e89\u529b\u5f3a<\/td>\n<td>\u76f8\u5bf9\u8f83\u65b0<\/td>\n<td>\u5927\u578b\u4f01\u4e1a\u7ea7\u67b6\u6784<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e8c\u3001RabbitMQ\u5feb\u901f\u4e0a\u624b<\/h3>\n<h4>2.1 RabbitMQ\u7b80\u4ecb<\/h4>\n<p>RabbitMQ\u8bde\u751f\u4e8e2005\u5e74&#xff0c;\u662f\u4e00\u6b3e\u57fa\u4e8eAMQP\u534f\u8bae\u7684\u8001\u724c\u6d88\u606f\u961f\u5217&#xff0c;\u81f3\u4eca\u4f9d\u7136\u6d3b\u8dc3\u3002\u5176\u5b98\u7f51&#xff08;https:\/\/www.rabbitmq.com\/&#xff09;\u76ee\u524d\u6700\u65b0\u7248\u672c\u4e3a3.13.x&#xff0c;\u4f9d\u7136\u4fdd\u6301\u5f3a\u52b2\u7684\u5f00\u53d1\u6d3b\u529b\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u9009\u62e9RabbitMQ&#xff1f;<\/p>\n<ul>\n<li>\n<p>\u53ef\u9760\u7a33\u5b9a&#xff1a;\u652f\u6301\u6d88\u606f\u786e\u8ba4\u3001\u96c6\u7fa4\u590d\u5236<\/p>\n<\/li>\n<li>\n<p>\u7075\u6d3b\u8def\u7531&#xff1a;\u652f\u6301\u591a\u79cdExchange\u7c7b\u578b\u4e0e\u7ed1\u5b9a\u7b56\u7565<\/p>\n<\/li>\n<li>\n<p>\u8de8\u8bed\u8a00\u652f\u6301&#xff1a;\u63d0\u4f9b\u591a\u8bed\u8a00\u5ba2\u6237\u7aef&#xff0c;\u65e0\u5382\u5546\u9501\u5b9a<\/p>\n<\/li>\n<\/ul>\n<h4>2.2 \u5b89\u88c5RabbitMQ&#xff08;CentOS\u4e3a\u4f8b&#xff09;<\/h4>\n<h5>\u524d\u7f6e\u73af\u5883&#xff1a;<\/h5>\n<ul>\n<li>\n<p>CentOS 8 \u6216 9&#xff08;\u63a8\u8350&#xff09;<\/p>\n<\/li>\n<li>\n<p>Erlang 26.x&#xff08;\u9700\u4e0eRabbitMQ\u7248\u672c\u5339\u914d&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h5>\u5b89\u88c5\u6b65\u9aa4&#xff1a;<\/h5>\n<p># 1. \u5b89\u88c5Erlang&#xff08;\u4f7f\u7528RabbitMQ\u63d0\u4f9b\u7684\u65e0\u4f9d\u8d56\u7248\u672c&#xff09;<br \/>\nrpm -ivh erlang-26.2.5.2-1.e19.x86_64.rpm<\/p>\n<p># 2. \u5b89\u88c5RabbitMQ<br \/>\nrpm -ivh rabbitmq-server-3.13.6-1.e18.noarch.rpm<\/p>\n<p># 3. \u542f\u52a8\u670d\u52a1<br \/>\nservice rabbitmq-server start<br \/>\nrabbitmqctl start_app<\/p>\n<p># 4. \u542f\u7528\u7ba1\u7406\u63d2\u4ef6<br \/>\nrabbitmq-plugins enable rabbitmq_management<\/p>\n<p># 5. \u91cd\u542f\u670d\u52a1\u751f\u6548<br \/>\nservice rabbitmq-server restart<br \/>\nrabbitmqctl start_app<\/p>\n<p># 6. \u521b\u5efa\u7ba1\u7406\u5458\u8d26\u53f7&#xff08;\u9ed8\u8ba4guest\u53ea\u80fd\u672c\u5730\u767b\u5f55&#xff09;<br \/>\nrabbitmqctl add_user admin admin<br \/>\nrabbitmqctl set_permissions -p \/ admin &#034;.*&#034; &#034;.*&#034; &#034;.*&#034;<br \/>\nrabbitmqctl set_user_tags admin administrator <\/p>\n<p>\u8bbf\u95ee\u00a0http:\/\/\u670d\u52a1\u5668IP:15672&#xff0c;\u4f7f\u7528\u00a0admin\/admin\u00a0\u767b\u5f55\u7ba1\u7406\u754c\u9762\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001RabbitMQ\u6838\u5fc3\u6982\u5ff5\u4e0e\u5b9e\u8df5<\/h3>\n<h4>3.1 Queue&#xff08;\u961f\u5217&#xff09;\u2014\u2014\u6d88\u606f\u7684\u6700\u7ec8\u5f52\u5bbf<\/h4>\n<p>\u961f\u5217\u662fRabbitMQ\u4e2d\u5b9e\u9645\u5b58\u50a8\u6d88\u606f\u7684\u7ec4\u4ef6&#xff0c;\u9075\u5faaFIFO\u539f\u5219\u3002\u53ef\u901a\u8fc7\u7ba1\u7406\u754c\u9762\u521b\u5efa&#xff1a;<\/p>\n<li>\n<p>\u8fdb\u5165\u00a0Queues\u00a0\u83dc\u5355<\/p>\n<\/li>\n<li>\n<p>\u70b9\u51fb\u00a0Add a new queue<\/p>\n<\/li>\n<li>\n<p>\u8f93\u5165\u961f\u5217\u540d&#xff08;\u5982\u00a0test1&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u53ef\u5728\u961f\u5217\u8be6\u60c5\u9875\u76f4\u63a5\u53d1\u9001\/\u63a5\u6536\u6d88\u606f\u8fdb\u884c\u6d4b\u8bd5<\/p>\n<\/li>\n<h4>3.2 Exchange&#xff08;\u4ea4\u6362\u673a&#xff09;\u2014\u2014\u6d88\u606f\u7684\u8def\u7531\u4e2d\u67a2<\/h4>\n<p>Exchange\u4e0d\u5b58\u50a8\u6d88\u606f&#xff0c;\u53ea\u8d1f\u8d23\u5c06\u6d88\u606f\u8def\u7531\u5230\u7ed1\u5b9a\u7684\u961f\u5217\u3002RabbitMQ\u9884\u7f6e\u4e86\u591a\u79cd\u7c7b\u578b\u7684Exchange&#xff1a;<\/p>\n<ul>\n<li>\n<p>direct&#xff1a;\u7cbe\u786e\u5339\u914dRouting Key<\/p>\n<\/li>\n<li>\n<p>fanout&#xff1a;\u5e7f\u64ad\u5230\u6240\u6709\u7ed1\u5b9a\u961f\u5217<\/p>\n<\/li>\n<li>\n<p>topic&#xff1a;\u6a21\u5f0f\u5339\u914dRouting Key<\/p>\n<\/li>\n<li>\n<p>headers&#xff1a;\u901a\u8fc7\u6d88\u606f\u5934\u5339\u914d<\/p>\n<\/li>\n<\/ul>\n<p>\u7ed1\u5b9a\u961f\u5217\u5230Exchange&#xff1a;<\/p>\n<li>\n<p>\u8fdb\u5165\u00a0Exchanges\u00a0\u83dc\u5355<\/p>\n<\/li>\n<li>\n<p>\u9009\u62e9\u67d0\u4e2aExchange&#xff08;\u5982\u00a0amq.direct&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u5728\u00a0Bindings\u00a0\u4e2d\u6dfb\u52a0\u7ed1\u5b9a&#xff0c;\u6307\u5b9a\u76ee\u6807\u961f\u5217<\/p>\n<\/li>\n<h4>3.3 Connection\u4e0eChannel\u2014\u2014\u5ba2\u6237\u7aef\u901a\u4fe1\u57fa\u77f3<\/h4>\n<ul>\n<li>\n<p>Connection&#xff1a;\u5ba2\u6237\u7aef\u4e0eRabbitMQ\u4e4b\u95f4\u7684TCP\u8fde\u63a5<\/p>\n<\/li>\n<li>\n<p>Channel&#xff1a;\u5efa\u7acb\u5728Connection\u4e4b\u4e0a\u7684\u865a\u62df\u8fde\u63a5&#xff0c;\u5b9e\u9645\u7684\u6570\u636e\u64cd\u4f5c\u90fd\u5728Channel\u4e2d\u8fdb\u884c<\/p>\n<\/li>\n<\/ul>\n<p>\u4e00\u4e2aConnection\u53ef\u521b\u5efa\u591a\u4e2aChannel&#xff0c;\u4ee5\u652f\u6301\u591a\u7ebf\u7a0b\u5e76\u53d1&#xff0c;\u590d\u7528TCP\u8fde\u63a5\u51cf\u5c11\u5f00\u9500\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001Java\u5ba2\u6237\u7aef\u5b9e\u6218\u793a\u4f8b<\/h3>\n<h4>4.1 Maven\u4f9d\u8d56<\/h4>\n<p>&lt;dependency&gt;<br \/>\n    &lt;groupId&gt;com.rabbitmq&lt;\/groupId&gt;<br \/>\n    &lt;artifactId&gt;amqp-client&lt;\/artifactId&gt;<br \/>\n    &lt;version&gt;5.16.0&lt;\/version&gt;<br \/>\n&lt;\/dependency&gt; <\/p>\n<h4>4.2 \u6d88\u8d39\u8005\u793a\u4f8b\u4ee3\u7801<\/h4>\n<p>public class RabbitMQConsumer {<br \/>\n    private static final String HOST &#061; &#034;192.168.65.112&#034;;<br \/>\n    private static final int PORT &#061; 5672;<br \/>\n    private static final String QUEUE_NAME &#061; &#034;test2&#034;;<br \/>\n    private static final String USER &#061; &#034;admin&#034;;<br \/>\n    private static final String PASS &#061; &#034;admin&#034;;<br \/>\n    private static final String VHOST &#061; &#034;\/mirror&#034;;<\/p>\n<p>    public static void main(String[] args) throws Exception {<br \/>\n        ConnectionFactory factory &#061; new ConnectionFactory();<br \/>\n        factory.setHost(HOST);<br \/>\n        factory.setPort(PORT);<br \/>\n        factory.setUsername(USER);<br \/>\n        factory.setPassword(PASS);<br \/>\n        factory.setVirtualHost(VHOST);<\/p>\n<p>        Connection connection &#061; factory.newConnection();<br \/>\n        Channel channel &#061; connection.createChannel();<\/p>\n<p>        \/\/ \u58f0\u660e\u961f\u5217&#xff08;\u5982\u679c\u4e0d\u5b58\u5728\u5219\u521b\u5efa&#xff09;<br \/>\n        channel.queueDeclare(QUEUE_NAME, true, false, false, null);<\/p>\n<p>        \/\/ \u6bcf\u6b21\u53ea\u5904\u7406\u4e00\u6761\u6d88\u606f<br \/>\n        channel.basicQos(1);<\/p>\n<p>        Consumer consumer &#061; new DefaultConsumer(channel) {<br \/>\n            &#064;Override<br \/>\n            public void handleDelivery(String consumerTag,<br \/>\n                                       Envelope envelope,<br \/>\n                                       AMQP.BasicProperties properties,<br \/>\n                                       byte[] body) throws IOException {<br \/>\n                String message &#061; new String(body, &#034;UTF-8&#034;);<br \/>\n                System.out.println(&#034;\u6536\u5230\u6d88\u606f: &#034; &#043; message);<br \/>\n                System.out.println(&#034;RoutingKey: &#034; &#043; envelope.getRoutingKey());<\/p>\n<p>                \/\/ \u624b\u52a8\u786e\u8ba4\u6d88\u606f<br \/>\n                channel.basicAck(envelope.getDeliveryTag(), false);<br \/>\n            }<br \/>\n        };<\/p>\n<p>        \/\/ \u5f00\u59cb\u6d88\u8d39<br \/>\n        channel.basicConsume(QUEUE_NAME, false, consumer);<br \/>\n        System.out.println(&#034;\u6d88\u8d39\u8005\u5df2\u542f\u52a8&#xff0c;\u7b49\u5f85\u6d88\u606f&#8230;&#034;);<br \/>\n    }<br \/>\n} <\/p>\n<h4>4.3 \u5173\u952e\u70b9\u8bf4\u660e<\/h4>\n<li>\n<p>\u8fde\u63a5\u53c2\u6570&#xff1a;\u6ce8\u610f\u6307\u5b9avirtual host&#xff0c;\u9ed8\u8ba4\u662f\u00a0\/<\/p>\n<\/li>\n<li>\n<p>\u961f\u5217\u58f0\u660e&#xff1a;\u5982\u679c\u961f\u5217\u5df2\u5b58\u5728&#xff0c;\u5c5e\u6027\u5fc5\u987b\u5339\u914d&#xff0c;\u5426\u5219\u62a5\u9519<\/p>\n<\/li>\n<li>\n<p>\u6d88\u606f\u786e\u8ba4&#xff1a;\u624b\u52a8\u786e\u8ba4&#xff08;basicAck&#xff09;\u786e\u4fdd\u6d88\u606f\u4e0d\u4e22\u5931<\/p>\n<\/li>\n<li>\n<p>QoS\u8bbe\u7f6e&#xff1a;\u63a7\u5236\u6d88\u8d39\u8005\u540c\u65f6\u5904\u7406\u7684\u6d88\u606f\u6570&#xff0c;\u907f\u514d\u8fc7\u8f7d<\/p>\n<\/li>\n<hr \/>\n<h3>\u4e94\u3001\u6838\u5fc3\u6982\u5ff5\u603b\u7ed3<\/h3>\n<table>\n<tr>\u6982\u5ff5\u8bf4\u660e\u662f\u5426\u5fc5\u987b<\/tr>\n<tbody>\n<tr>\n<td>Queue<\/td>\n<td>\u5b9e\u9645\u5b58\u50a8\u6d88\u606f\u7684FIFO\u961f\u5217<\/td>\n<td>\u662f<\/td>\n<\/tr>\n<tr>\n<td>Exchange<\/td>\n<td>\u6d88\u606f\u8def\u7531\u7ec4\u4ef6&#xff0c;\u4e0d\u5b58\u50a8\u6d88\u606f<\/td>\n<td>\u5426&#xff08;\u4f46\u5efa\u8bae\u4f7f\u7528&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Virtual Host<\/td>\n<td>\u865a\u62df\u4e3b\u673a&#xff0c;\u5b9e\u73b0\u8d44\u6e90\u9694\u79bb<\/td>\n<td>\u5426&#xff08;\u9ed8\u8ba4\u4f7f\u7528\u00a0\/&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Connection<\/td>\n<td>\u5ba2\u6237\u7aef\u4e0eRabbitMQ\u7684TCP\u8fde\u63a5<\/td>\n<td>\u662f<\/td>\n<\/tr>\n<tr>\n<td>Channel<\/td>\n<td>\u5efa\u7acb\u5728Connection\u4e0a\u7684\u865a\u62df\u901a\u9053<\/td>\n<td>\u662f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6d88\u606f\u6d41\u8f6c\u6a21\u578b&#xff1a;<\/p>\n<p> Producer \u2192 Exchange \u2192 (\u7ed1\u5b9a\u89c4\u5219) \u2192 Queue \u2192 Consumer <\/p>\n<hr \/>\n<h3>\u516d\u3001\u4f7f\u7528\u5efa\u8bae\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<li>\n<p>Virtual Host\u89c4\u5212&#xff1a;\u6309\u4e1a\u52a1\u6216\u56e2\u961f\u5212\u5206vhost&#xff0c;\u5b9e\u73b0\u8d44\u6e90\u9694\u79bb<\/p>\n<\/li>\n<li>\n<p>Exchange\u7c7b\u578b\u9009\u62e9&#xff1a;\u6839\u636e\u8def\u7531\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684Exchange\u7c7b\u578b<\/p>\n<\/li>\n<li>\n<p>\u8fde\u63a5\u7ba1\u7406&#xff1a;\u5408\u7406\u4f7f\u7528Connection\u548cChannel&#xff0c;\u907f\u514d\u9891\u7e41\u521b\u5efa\u9500\u6bc1<\/p>\n<\/li>\n<li>\n<p>\u6d88\u606f\u786e\u8ba4\u673a\u5236&#xff1a;\u751f\u4ea7\u73af\u5883\u5efa\u8bae\u4f7f\u7528\u624b\u52a8\u786e\u8ba4&#xff08;manual acknowledgement&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u76d1\u63a7\u4e0e\u7ba1\u7406&#xff1a;\u5584\u7528Web\u63a7\u5236\u53f0\u76d1\u63a7Connections\u3001Channels\u3001Queues\u72b6\u6001<\/p>\n<\/li>\n<hr \/>\n<h3>\u4e03\u3001\u7ed3\u8bed<\/h3>\n<p>RabbitMQ\u4f5c\u4e3a\u4e00\u6b3e\u7ecf\u5178\u7684\u6d88\u606f\u961f\u5217\u4e2d\u95f4\u4ef6&#xff0c;\u4ee5\u5176\u53ef\u9760\u6027\u3001\u7075\u6d3b\u6027\u548c\u8de8\u5e73\u53f0\u652f\u6301\u5728\u4f01\u4e1a\u7ea7\u5e94\u7528\u4e2d\u5360\u636e\u91cd\u8981\u5730\u4f4d\u3002\u901a\u8fc7\u672c\u6587\u7684\u5feb\u901f\u4e0a\u624b\u6307\u5357&#xff0c;\u4f60\u5e94\u8be5\u5df2\u7ecf\u638c\u63e1\u4e86&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u2705 MQ\u7684\u57fa\u672c\u6982\u5ff5\u4e0e\u4ef7\u503c<\/p>\n<\/li>\n<li>\n<p>\u2705 RabbitMQ\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e<\/p>\n<\/li>\n<li>\n<p>\u2705 \u6838\u5fc3\u7ec4\u4ef6\u7684\u7406\u89e3\u4e0e\u4f7f\u7528<\/p>\n<\/li>\n<li>\n<p>\u2705 Java\u5ba2\u6237\u7aef\u7684\u7f16\u5199\u4e0e\u8c03\u8bd5<\/p>\n<\/li>\n<\/ul>\n<p>\u4e0b\u4e00\u6b65\u5efa\u8bae&#xff1a;<\/p>\n<li>\n<p>\u5c1d\u8bd5\u7f16\u5199\u751f\u4ea7\u8005\u7a0b\u5e8f<\/p>\n<\/li>\n<li>\n<p>\u5b9e\u9a8c\u4e0d\u540cExchange\u7c7b\u578b\u7684\u8def\u7531\u6548\u679c<\/p>\n<\/li>\n<li>\n<p>\u642d\u5efaRabbitMQ\u96c6\u7fa4<\/p>\n<\/li>\n<li>\n<p>\u5b66\u4e60\u9ad8\u7ea7\u7279\u6027\u5982TTL\u3001\u6b7b\u4fe1\u961f\u5217\u3001\u5ef6\u8fdf\u961f\u5217\u7b49<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4ec0\u4e48\u662fMQ&#xff1f;\u6211\u4eec\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f;<br \/>\n1.1 MQ\u7684\u5b9a\u4e49\u4e0e\u4f5c\u7528<br \/>\nMQ&#xff08;Message Queue&#xff0c;\u6d88\u606f\u961f\u5217&#xff09;\u00a0\u662f\u4e00\u79cd\u5728\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u7684\u4e2d\u95f4\u4ef6\u3002\u5b83\u7531\u4e24\u90e8\u5206\u7ec4\u6210&#xff1a; Message&#xff08;\u6d88\u606f&#xff09;&#xff1a;\u5728\u4e0d\u540c\u5e94\u7528\u95f4\u4f20\u9012\u7684\u6570\u636e\u8f7d\u4f53  Queue&#xff08;\u961f\u5217&#xff09;&#xff1a;\u9075\u5faaFIFO&#xff08;\u5148\u8fdb\u5148\u51fa&#xff09;\u539f\u5219\u7684\u6570\u636e\u7ed3\u6784<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[663,664,1155],"topic":[],"class_list":["post-62108","post","type-post","status-publish","format-standard","hentry","category-server","tag-rabbitmq","tag-664","tag-1155"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/62108.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u4ec0\u4e48\u662fMQ&#xff1f;\u6211\u4eec\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f; 1.1 MQ\u7684\u5b9a\u4e49\u4e0e\u4f5c\u7528 MQ&#xff08;Message Queue&#xff0c;\u6d88\u606f\u961f\u5217&#xff09;\u00a0\u662f\u4e00\u79cd\u5728\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u7684\u4e2d\u95f4\u4ef6\u3002\u5b83\u7531\u4e24\u90e8\u5206\u7ec4\u6210&#xff1a; Message&#xff08;\u6d88\u606f&#xff09;&#xff1a;\u5728\u4e0d\u540c\u5e94\u7528\u95f4\u4f20\u9012\u7684\u6570\u636e\u8f7d\u4f53 Queue&#xff08;\u961f\u5217&#xff09;&#xff1a;\u9075\u5faaFIFO&#xff08;\u5148\u8fdb\u5148\u51fa&#xff09;\u539f\u5219\u7684\u6570\u636e\u7ed3\u6784\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/62108.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-19T02:57:48+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62108.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/62108.html\",\"name\":\"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-19T02:57:48+00:00\",\"dateModified\":\"2026-01-19T02:57:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/62108.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/62108.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/62108.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/62108.html","og_locale":"zh_CN","og_type":"article","og_title":"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u4ec0\u4e48\u662fMQ&#xff1f;\u6211\u4eec\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83&#xff1f; 1.1 MQ\u7684\u5b9a\u4e49\u4e0e\u4f5c\u7528 MQ&#xff08;Message Queue&#xff0c;\u6d88\u606f\u961f\u5217&#xff09;\u00a0\u662f\u4e00\u79cd\u5728\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u7684\u4e2d\u95f4\u4ef6\u3002\u5b83\u7531\u4e24\u90e8\u5206\u7ec4\u6210&#xff1a; Message&#xff08;\u6d88\u606f&#xff09;&#xff1a;\u5728\u4e0d\u540c\u5e94\u7528\u95f4\u4f20\u9012\u7684\u6570\u636e\u8f7d\u4f53 Queue&#xff08;\u961f\u5217&#xff09;&#xff1a;\u9075\u5faaFIFO&#xff08;\u5148\u8fdb\u5148\u51fa&#xff09;\u539f\u5219\u7684\u6570\u636e\u7ed3\u6784","og_url":"https:\/\/www.wsisp.com\/helps\/62108.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-19T02:57:48+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/62108.html","url":"https:\/\/www.wsisp.com\/helps\/62108.html","name":"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-19T02:57:48+00:00","dateModified":"2026-01-19T02:57:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/62108.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/62108.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/62108.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"RabbitMQ\u5feb\u901f\u4e0a\u624b\u4e0e\u6838\u5fc3\u6982\u5ff5\u8be6\u89e3"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=62108"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/62108\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=62108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=62108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=62108"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=62108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}