I've setup things in a pretty similar way to the blog posts about it but I'm getting an error when at start up about one of the queues.
The msmq://localhost/colin_console_queue
doesn't get created automatically by my program.
I'm fairly sure I'm just not doing something right but I don't know what I've omitted.
I did discover an 'DisableAutoQueueCreation' attribute and I tried setting it to false on the various config elements and I even discovered it was available as a property on the RhinoServiceBusFacility
so I tried setting it there too. Unfortunately none of that seemed to work.
If I change the two urls to point to the same Queue the app basically works but I'm fairly sure that's not what I'm supposed to do. I looked at the Starbucks example app to see what it does but it appears to do a lot of setup using hard coded paths in the code.
<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>
Here's my test program I'm using to figure out how to use the Queue.
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();
}
}
Here is the error I get,
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
Thanks to Ayende (via email) the answer turns out to be because the queue you listen to (the one mentioned in the bus tag) is the only one you're responsible for creating automatically.
My example program is quite flawed though so I rewrote things completely and made use of the one way queue to ensure I understood it properly (well I think I do!). I'll perhaps put up the example at some point because I certainly had a bit of difficulty grokking it all.