views:

143

answers:

1

I am having trouble wiring the events for my Castle.Windsor IoV components. Even though I have confirmed the methods and the signatures for them, it throws an exception with the message "Object does not match target type".

Can anyone please explain what object exactly its expecting?

My wiring looks like:

  <component
    id="mailManager"
    service="Pop3Dispatcher.Mail.IMailManager, Pop3Dispatcher"
    type="Pop3Dispatcher.Mail.DefaultMailManagerImpl, Pop3Dispatcher"
    startable="true"
    loadCompletedMethod="Init">
    <subscribers>
      <subscriber id="emailFilterImpl" event="MessageRecieved" handler="OnReceivedMessage"/>
    </subscribers>
  </component>

  <component 
    id="emailFilterImpl" 
    service="Pop3Dispatcher.Filters.IFilter, Pop3Dispatcher"
    type="Pop3Dispatcher.Filters.EmailFilterImpl, Pop3Dispatcher" 
    startable="true">
  </component>

Before anyone asks, yes I have included:

<facilities>

  <facility
      id="event.wiring"
      type="Castle.Facilities.EventWiring.EventWiringFacility, Castle.MicroKernel" />

</facilities>
A: 

Ok, problem solved, apparently in this case, the order of declaration matters. Alos, it doesnt support "services" and must be subscribd to the type directly.

  <component 
    id="emailFilterImpl" 
    type="Pop3Dispatcher.Filters.EmailFilterImpl, Pop3Dispatcher" 
    startable="true">
  </component>

  <component
    id="mailManager"
    type="Pop3Dispatcher.Mail.DefaultMailManagerImpl, Pop3Dispatcher"
    startable="true"
    loadCompletedMethod="Init">
    <subscribers>
      <subscriber id="emailFilterImpl" event="MessageRecieved" handler="OnReceivedMessage"/>
    </subscribers>
  </component>
Ash