为什么不Rhino.ServiceBus自动创建我的所有队列?
-
19-09-2019 - |
题
我在一个非常相似的方式来关于它的博客帖子设置的事情,但我得到一个错误,当启动时的队列中大约之一。
在msmq://localhost/colin_console_queue
不会被自动我的程序创建的。
我确信我只是没有做正确的事情,但我不知道我遗漏了什么。
我没有发现一个“DisableAutoQueueCreation”属性,我试图将其设置为假的各种配置元素,我甚至发现它可以作为对RhinoServiceBusFacility
的属性,所以我尝试设置它有太多。不幸的是没有的,似乎工作。
如果我更改了两个网址指向同一队列的应用基本工作原理,但我相当肯定,这不是我应该做的。我看着星巴克示例应用程序,看看它做什么,但它出现在代码中使用硬编码路径做了很多设置。
<facilities>
<facility id="rhino.esb">
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/colin_console_queue_bus"
logEndpoint="msmq://localhost/colin_console_queue_bus.log" />
<messages>
<add name="ConsoleApplication1" endpoint="msmq://localhost/colin_console_queue" />
</messages>
</facility>
</facilities>
下面是我使用弄清楚如何使用队列我的测试程序。
static void Main(string[] args)
{
var container = new WindsorContainer(new XmlInterpreter());
container.Kernel.AddFacility("rhino.esb", new RhinoServiceBusFacility());
if (args.Length > 0)
{
var bus = container.Resolve<IStartableServiceBus>();
bus.Start();
bus.Send(new EmailMessage { Message = args[0], To = "test" });
bus.Dispose();
}
else
{
container.Register(AllTypes.FromAssembly(Assembly.GetExecutingAssembly()).BasedOn(typeof(IMessageConsumer)));
var bus = container.Resolve<IStartableServiceBus>();
bus.Start();
Console.ReadLine();
Console.WriteLine("Bus stopped");
bus.Dispose();
}
}
下面是我的错误,
Unhandled Exception: System.Transactions.TransactionException: Failed to send message to Uri: msmq://colin-pc/colin_console_queue ---> Rhino.ServiceBus.Exceptions.TransportException: The queue msmq://colin-pc/colin_console_queue does not exists
at Rhino.ServiceBus.Msmq.OpenedQueue..ctor(QueueInfo info, MessageQueue queue, String url, Nullable`1 transactional) in D:\Work\rhino-esb\Rhino.ServiceBus\Msmq\OpenedQueue.cs:line 24
at Rhino.ServiceBus.Msmq.QueueInfo.Open(QueueAccessMode access, IMessageFormatter formatter) in D:\Work\rhino-esb\Rhino.ServiceBus\Msmq\QueueInfo.cs:line 71
at Rhino.ServiceBus.Msmq.QueueInfo.Open(QueueAccessMode access) in D:\Work\rhino-esb\Rhino.ServiceBus\Msmq\QueueInfo.cs:line 63
at Rhino.ServiceBus.Msmq.MsmqTransport.SendMessageToQueue(Message message, Endpoint endpoint) in D:\Work\rhino-esb\Rhino.ServiceBus\Msmq\MsmqTransport.cs:line 303
解决方案
感谢Ayende(通过电子邮件)的答案原来是因为你听(在公交标签提到的)队列为你负责自动创建唯一的一个。
我的示例程序是相当有缺陷,但这样我完全重写的东西,利用单向队列,以确保我的理解是正确的(嗯,我想我做的!)。我也许会挂上例如在某些时候,因为我确实有一点难度所著的Grokking这一切。
其他提示
那么,在一般的web应用程序不应该的东西作为抵达迪南到基础设施的消息队列排队服务器的配置做行政诉讼。真。正常的行政guidleines - 这就是为什么程序员可能没想到someoen甚至会尝试
请参阅,可以存在更多的将u pthe队列比你想的。)像配置它
手动设置的队列。
不隶属于 StackOverflow