首页 \ 问答 \ RabbitMQ路由行为(RabbitMQ routing behavior)

RabbitMQ路由行为(RabbitMQ routing behavior)

我正在尝试通过RabbitMQ将消息发布到2个不同的队列,但事情并不像我预期的那样,这里是详细信息:

我有一个交换:amq.fanout,类型:扇出,绑定是队列:Q1,路由键:key1和队列:Q2,路由键:key2。

在我的客户端,我有这个代码

var model = connection.CreateModel(); model.ExchangeDeclare("amq.fanout", "fanout", true); model.BasicPublish("amq.fanout", "key1", null, body);

我想将主体发布到Q1,因为它有key1作为路由键,但Q1和Q2都收到了正文,我的代码或服务器配置有什么问题吗?


I'm trying to publish message to 2 different queueus via RabbitMQ, but things do not behave as what I expected, here is the detail:

I have an exchange: amq.fanout, type: fanout, and the bindings are Queue: Q1, Routing key: key1, and Queue: Q2, Routing key: key2.

In my client side, I have this code

var model = connection.CreateModel(); model.ExchangeDeclare("amq.fanout", "fanout", true); model.BasicPublish("amq.fanout", "key1", null, body);

I'm supposing to publish the body to Q1, because it has the key1 as the routing key, however, both Q1 and Q2 received the body, is there anything wrong with my code or server config?


原文:https://stackoverflow.com/questions/38908251
更新时间:2022-05-03 10:05

最满意答案

当应用程序在Android设备上运行时,我逐步执行代码,但异常发生在不属于应用程序的代码中

正如您所做的那样,在调试器中逐行逐步执行应用程序代码,直到您到达抛出异常之前运行的最后一行。

在这一行,你会找到一个外部库的调用。 你说你没有这个库的来源。 这是不幸的,但这不是结束。

最简单的后续步骤来自于意识到您的异常很可能是由以下两种情况之一引起的:

1)您正在以不被设计使用的方式使用外部库。 例如,向它提供一些不良数据,不按顺序使用其功能,或者只是以错误的方式。 阅读文档并尝试了解这是否是问题所在。 如果没有文件,那么......欢迎来到地狱。

2)您对外部图书馆的呼叫服从其合同并且是正确的。 如果是这种情况,库本身可能存在错误。 根据库,请查阅文档或任何在线社区站点,以验证是否已知该特定错误,是否存在解决方法,或者您是否遇到问题。

找出这两件事中的哪一件,然后决定如何继续前进。 它可能正在改变您的代码,它可能正在改变您使用的库,它可能是两者的某种组合。 没有任何更多的细节,这是不可能的。 祝你好运!


I step through the code as the application is running on the Android device but the exception occurs in code that is not part of the application

As you've done, step through your application code line by line in a debugger, until you get to the last line which runs before the exception is thrown.

On this line, you'll find a call to some external library. You've said you don't have the source for this library. That's unfortunate, but it's not the end of the road.

The simplest next steps come from realising that your exception is most probably caused by one of two things:

1) You're using the external library in a way it wasn't designed to be used. For example, feeding it some bad data, using its functionality out of sequence, or just in the wrong way. Read the documentation and try to understand if this is the problem. If there is no documentation, well.. welcome to hell.

2) Your call to the external library obeys its contract and is correct. If that's the case, there may be a bug in the library itself. Depending on the library, consult the documentation or any online community sites to verify if that specific bug is known, if there's a workaround, or if you're stuck.

Find out which of these two things it is, then make a decision on how to move on. It might be changing your code, it might be changing the library you use, it might be some combination of the two. Without any more details it's impossible to say. Good luck!

相关问答

更多
  • ViewPagerIndicator是要使用的正确库。 特别是,您需要CirclePageIndicator ViewPagerIndicator is the right library to use. In particular, you need the CirclePageIndicator
  • 这是设置phpstorm的教程 - https://www.jetbrains.com/phpstorm/help/configuring-xdebug.html 您还需要在浏览器中触发调试器 - 最简单的Xdebug Firefox的这个扩展是为了使用IDE更容易调试而构建的。 您可以在https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/找到该扩展程序。 适用于Chrome的Xdebug Helper此Chrome扩展程序可帮 ...
  • 当应用程序在Android设备上运行时,我逐步执行代码,但异常发生在不属于应用程序的代码中 正如您所做的那样,在调试器中逐行逐步执行应用程序代码,直到您到达抛出异常之前运行的最后一行。 在这一行,你会找到一个外部库的调用。 你说你没有这个库的来源。 这是不幸的,但这不是结束。 最简单的后续步骤来自于意识到您的异常很可能是由以下两种情况之一引起的: 1)您正在以不被设计使用的方式使用外部库。 例如,向它提供一些不良数据,不按顺序使用其功能,或者只是以错误的方式。 阅读文档并尝试了解这是否是问题所在。 如果没有 ...
  • 见于: http : //www.eguneys.com/blog/2014/09/17/lets-build-a-yeoman-generator-2 发布您的生成器 最后,您可以发布您的生成器。 首先在npm上创建一个帐户。 接下来设置您的npm作者信息。 $ npm set init.author.name "Your Name" $ npm set init.author.email "Your Email" $ npm set init.author.url "Your Website" $ n ...
  • 您可能必须将当前路径添加到类路径。 在Unix / Linux / Mac上: java -cp .:lib/htmlunit-2.9.jar test 在Windows上: java -cp .;lib/htmlunit-2.9.jar test 编辑实际上htmlunit需要更多的罐子,只需要htmlunit-2.9.jar。 因此,考虑到所有必需的jar都位于lib /目录中,您应该实际调用以下内容: 在Unix / Linux / Mac上: java -cp .:lib/* test 如果从 ...
  • Rails真的很难学。 如果您不想再阅读指南,那么您可以在Github上查看Rails应用程序或观看Rails4Zombies。 是的,您需要一个路由和控制器和模型以及迁移和视图(多个视图,每个视图都有表单)。 但是我们告诉你阅读指南的原因是因为这几乎是你作为Rails开发人员必须做的第一件事,“创建读取更新删除”,在你的情况下是创建,读取,更新,并删除项目。 实际上,如果你考虑一下,你就是在做Twitter的事情。 只需将“tweet”替换为项目并添加其他字段即可。 Rails is really har ...
  • 如果我没错,那么在onStepChanging方法中放置ajax调用应该可行。 请注意,您有3个可用参数,其中一个 - event - 应该是单击的按钮。 如果需要,可以使用它来更好地定义url var。 同样使用currentIndex您可以检测您是否处于第一步。 form.steps({ onStepChanging: function (event, currentIndex, newIndex) { if (currentIndex == 0) { //I suppo ...
  • 这是给你的一个想法。 假设您从10开始计算collatz序列: >>> collatz(10) [10, 5, 16, 8, 4, 2, 1] 你看到有6个步骤回到1。 稍后假设您正在计算来自12的折叠序列。经过四个计算步骤: >>> collatz(12) [12, 6, 3, 10, ... 坚持一分钟!! 从12到10需要3个步骤。我们已经知道从10开始,需要6个步骤。 因此,我们已经告诉我们,从12开始有6 + 3步,而无需再费心去计算序列。 此外,如果我们在扩展一个连枷序列时再次看到12,可以 ...
  • 在给定的快照中,您已打开调试选项卡。 从底部选择Android Monitor选项卡,显示所有日志。 打开android选项卡后,您将看到一个带有选项verbose, error, info等的下拉列表。选择信息以查看错误日志。 同样在调试模式下,一旦到达e.printStackTrace()行,调试器将显示包含错误信息的e值。 In the given snapshots you have opened the debugging tab. Select the Android Monitor tab f ...
  • 有一个调试版的flash播放器,可以输出可能对你有帮助的诊断信息。 我意识到问题不一定是闪存,但它可能提供一些可能的问题的洞察力。 我必须承认我已经安装了一段时间,但我相信这些链接可能对您有所帮助: 关于如何配置调试器版本以输出日志的侮辱: http://kb2.adobe.com/cps/403/kb403009.html 调试器版本的下载链接: http://www.adobe.com/support/flashplayer/downloads.html We solved the problem in ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。