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
-~----------~----~----~----~------~----~------~--~---

Reply via email to