Adding thread.sleep did not change anything ant exception is still
thrown. Code:
WindsorContainer wc = new WindsorContainer(new
Castle.Windsor.Configuration.Interpreters.XmlInterpreter());
IStartableServiceBus isssb =
wc.Resolve<IStartableServiceBus>();
isssb.Start();
System.Threading.Thread.Sleep(2000);
IMyDearComponent mc = wc.Resolve<IMyDearComponent>();
mc.Test();
best regards
R
On Apr 13, 11:28 pm, Ayende Rahien <[email protected]> wrote:
> Hm, from your description, it sounds like you are running into a race
> condition.
> Put a Thread.Sleep(1500) before executing the code after you started up the
> bus, what is happening then?
>
> On Tue, Apr 14, 2009 at 12:20 AM, rg <[email protected]> wrote:
>
> > I have uploaded the sample application to this group files section
> > (WindsorTest2.zip -
> >http://groups.google.com/group/rhino-tools-dev/web/WindsorTest2.zip?h...
> > )
> > With this application the error is reproducible almost every time.
> > However, there was a single time when it worked. I inspected the
> > queues created by this app and there was a subscription message in the
> > rsbtest#subscriptions queue. So I deleted all the queues and ran the
> > application again - queues were created but subscription message was
> > not sent.
> > When debugging, in StartableServiceBus.Start, there's a call to
> > AutomaticallySubscribeConsumerMessages. But this method detects no
> > message handlers, so no wonder they are not registered. Very strange
> > it worked just once. My machine is win 2003 and the message queues
> > were automatically created by RSB.
>
> > On Apr 13, 9:47 pm, Ayende Rahien <[email protected]> wrote:
> > > Hm, that should work. Can you create a small test app for this?
>
> > > On Mon, Apr 13, 2009 at 11:43 PM, nightwatch77 <[email protected]
> > >wrote:
>
> > > > After briefly reading RSB source and some docs I see that the default
> > > > option for subscribing to messages is to implement interface
> > > > ConsumerOf<MessageType> and the service bus on start should search the
> > > > container and subscribe all registered consumer types. But I have a
> > > > problem with this. If you look at my previous post, I'm registering
> > > > RSB facitlity and MyDearComponent in the container. Now my component
> > > > implements ConsumerOf<MyDearMessage> and I'm publishing MyDearMessage
> > > > instance, but I get an exception saying that there were no subscribers
> > > > for this type of message. So what else do I need to do to get the
> > > > messsage delivered? My code is below.
>
> > > > [Serializable]
> > > > public class MyDearMessage
> > > > {
> > > > public string Body;
> > > > public MyDearMessage(string s) { Body = s; }
>
> > > > }
>
> > > > public class MyDearComponent : IMyDearComponent,
> > > > ConsumerOf<MyDearMessage>
> > > > {
> > > > private IServiceBus _sb;
>
> > > > public IServiceBus ServiceBus
> > > > {
> > > > get { return _sb; }
> > > > set { _sb = value; }
> > > > }
>
> > > > public void Test()
> > > > {
> > > > if (ServiceBus == null) throw new Exception("NO SB");
> > > > ServiceBus.Publish(new MyDearMessage("Jozin z bazin"));
> > > > Console.WriteLine("Sent.");
> > > > }
>
> > > > public void Consume(MyDearMessage message)
> > > > {
> > > > Console.WriteLine("Consuming message: " + message.Body);
> > > > }
> > > > }
>
> > > > <facilities>
> > > > <facility id="rhino.esb"
> > > > type="Rhino.ServiceBus.Impl.RhinoServiceBusFacility,
> > > > Rhino.ServiceBus">
> > > > <bus threadCount="1"
> > > > numberOfRetries="5"
> > > > endpoint="msmq://localhost/rsbtest"
> > > > />
> > > > <messages>
> > > > <add name="WindsorTest1"
> > > > endpoint="msmq://localhost/rsbtest"/>
> > > > </messages>
> > > > </facility>
> > > > </facilities>
>
> > > > <components>
>
> > > > <component id="MyComponent" type="WindsorTest1.MyDearComponent,
> > > > WindsorTest1" service="WindsorTest1.IMyDearComponent, WindsorTest1">
>
> > > > </component>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---