久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

RabbitMQ:如何指定要發(fā)布到的隊列?

RabbitMQ: How to specify the queue to publish to?(RabbitMQ:如何指定要發(fā)布到的隊列?)
本文介紹了RabbitMQ:如何指定要發(fā)布到的隊列?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

RabbitMQ 的 Channel#basicConsume 方法為我們提供了以下參數(shù):

RabbitMQ's Channel#basicConsume method gives us the following arguments:

channel.basicConsume(queueName, autoAck, consumerTag, noLocal,
    exclusive, arguments, callback);

讓我們能夠準(zhǔn)確地告訴 RabbitMQ 我們想從哪個隊列消費.

Giving us the ability to tell RabbitMQ exactly which queue we want to consume from.

但是 Channel#basicPublish 沒有這樣的等價性:

But Channel#basicPublish has no such equivalency:

channel.basicPublish(exchangeName, routingKey, mandatory, immediateFlag,
    basicProperties, messageAsBytes);

為什么我不能在這里指定要發(fā)布到的隊列?!?如何讓 Channel 發(fā)布到名為 logging 的隊列?提前致謝!

Why can't I specify the queue to publish to here?!? How do I get a Channel publishing to, say, a queue named logging? Thanks in advance!

推薦答案

隊列基本上可以基于routingKeys綁定到一個exchange.

Basically queues can be binded to an exchange based on routingKeys.

假設(shè)您有 3 個不同的發(fā)布商.
Publisher1發(fā)送消息與routingKey事件"進行交換
Publisher2 發(fā)送消息與 routingKey tasks"進行交換
Publisher3 發(fā)送消息與 routingKey jobs"進行交換

Assume that you have 3 different publishers.
Publisher1 sending message to exchange with routingKey "events"
Publisher2 sending message to exchange with routingKey "tasks"
Publisher3 sending message to exchange with routingKey "jobs"

您可以有一個只使用具有特定 routhingKey 的消息的消費者.
例如,為了讓您聲明這樣的事件"消息的消費者

You can have a consumer that consumes only messages with specific routhingKey.
For example in order to have a consumer for "events" messages you declare like this

 channel.queueBind(queueName, exchangeName, "events");

如果你想消耗所有進入交換的消息,你將路由指定為'#'

If you want to consume all the messages coming to the exchange you give the routing as '#'

總之我能說的是,
1. 消息將發(fā)布到交易所.
2. 隊列會根據(jù)routingKeys綁定交換.
3. RabbitMQ 會將路由鍵匹配的消息轉(zhuǎn)發(fā)到對應(yīng)的隊列中.

So in short what i can say is,
1. Messages will be published to an exchange.
2. Queues will be bound to exchange based on routingKeys.
3. RabbitMQ will forward messages with matching routing keys to the corresponding queues.

請看教程 - http://www.rabbitmq.com/tutorials/tutorial-three-java.html

RabbitMQ 中消息傳遞模型的核心思想是生產(chǎn)者永遠不會將任何消息直接發(fā)送到隊列.實際上,生產(chǎn)者通常根本不知道消息是否會被傳遞到任何隊列.相反,生產(chǎn)者只能向交換器發(fā)送消息

這篇關(guān)于RabbitMQ:如何指定要發(fā)布到的隊列?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 国产精品揄拍一区二区 | 久久av一区 | 在线中文字幕日韩 | 欧一区二区 | 国产丝袜人妖cd露出 | 久久久久国产 | 国产yw851.c免费观看网站 | 日本精品视频 | 精品少妇一区二区三区在线播放 | 在线免费黄色小视频 | 国产不卡一区 | 欧美成人一区二区 | 日韩专区中文字幕 | 国产在线网站 | 国产在线视频一区 | 精品久久影院 | 亚洲有码转帖 | 久久青| 色欧美综合 | 欧美精品一区二区三区蜜臀 | 激情 一区 | 91麻豆精品一区二区三区 | 国产精品视频网 | 国产一级片 | 黄色网址大全在线观看 | 一区二区中文 | 欧美激情第一区 | 久久这里只有精品首页 | 精品二三区 | 成人免费在线网 | 有码一区 | 欧美在线观看一区 | 亚洲视频中文字幕 | 在线资源视频 | 91网在线观看 | 国产一区二区三区视频 | 欧美日韩最新 | 亚洲国产aⅴ精品一区二区 免费观看av | 久久久久国产一区二区三区 | 亚洲精品片 | 狠狠夜夜 |