I recently spent a couple of hours debugging Castle Windsor, diagnosing the 
exact same issue.
 
The error message hints at the cause:
 
*.- Service 'Rhino.ServiceBus.Msmq.TransportActions.IMsmqTransportAction[]' 
which was not registered.*
 
One of the dependencies of MsmqTransport is an array of 
IMsmqTransportAction ("give me all registered actions"). Windsor by itself 
is not capable of resolving arrays/collections that weren't explicitely 
registered, it needs a SubDependencyResolver for that. And RSB's 
CastleBuilder installs one - the ArrayResolver. So far, so good.
 
There are, however, two factors:
1) Windsor's handling of dependencies is not uniform, there are at least 
two different code paths involved. One path uses the 
SubDependencyResolvers, another one - in certain circumstances - doesn't.
2) Windsor contains a performance optimization that turns off certain 
bookkeeping mechanisms for the duration of the IWindsorContainer.Install() 
call (those mechanisms are invoked at the end of the call). This causes 
that second code path mentioned above to be used, the ArrayResolver is not 
consulted and Windsor thinks it cannot resolve an array of 
IMsmqTransportActions.
 
A detailed analysis probably belongs on the Castle Project mailing list. To 
work around the problem, the call to 
container.Resolve<IStartableServiceBus>() should happen outside of (after) 
the Install call during which RSB components are registered. 
 
In my application I introduced the concept of an IStartupTask. My RSB 
installer does not resolve and start the bus. Instead it registers 
an IStartupTask to do that. The bootstrapper code looks like this:
container.Install(installers);
container.ResolveAll<IStartupTask>().ForEach(a => a.Perform());
 
(Note that the StartableFacility cannot be used for that, as it starts the 
components too early - at the end of the Install call, but unfortunately 
before the bookkeeping mechanisms are reenabled.)
 
Another way would probably be to create two installers: first one registers 
RSB components, second one starts the bus.
 
I do not know why the presence of the TypedFactoryFacility helps - I will 
probably investigate, out of curiosity, when I have some free time.
 
Regards,
Jakub Berezanski
 

On Tuesday, July 3, 2012 10:22:39 AM UTC+2, Dion wrote:

> Hi,
>
> I seems to be experiencing an error when running a very simple bus startup:
>
>     public class ModuleInstaller: IWindsorInstaller
>
>     {
>
>         public void Install(IWindsorContainer container, 
>> IConfigurationStore store)
>
>         {
>
>             new RhinoServiceBusConfiguration()
>
>                .UseCastleWindsor(container)
>
>                .Configure();
>
>             
>
>             container.Resolve<IStartableServiceBus>().Start();
>
>         }
>
>     }
>
>
> When this runs I then get the following error:
>
> *Can't create component 'Rhino.ServiceBus.Msmq.MsmqTransport' as it has 
> dependencies to be satisfied.*
> *
> *
> *'Rhino.ServiceBus.Msmq.MsmqTransport' is waiting for the following 
> dependencies:*
> *- Service 'Rhino.ServiceBus.Serializers.XmlMessageSerializer' which was 
> registered but is also waiting for dependencies.- Service 
> 'Rhino.ServiceBus.Msmq.TransportActions.IMsmqTransportAction[]' which was 
> not registered.*
> *- Service 'Rhino.ServiceBus.Impl.EndpointRouter' which was registered 
> but is also waiting for dependencies.- Service 
> 'Rhino.ServiceBus.Msmq.MsmqMessageBuilder' which was registered but is also 
> waiting for dependencies.*
> *'Rhino.ServiceBus.Msmq.MsmqMessageBuilder' is waiting for the following 
> dependencies:*
> *- Service 'Rhino.ServiceBus.Serializers.XmlMessageSerializer' which was 
> registered but is also waiting for dependencies. *
>
>
> This error confused me particularly because Windsor reported that these 
> components (like the *XmlMessageSerializer*) were registered correctly 
> and could be resolved.After searching long and hard and by pure chance, I 
> stumbled across the solution - to add the TypedFactoryFacility to the 
> Castle Windsor installation. This then worked like a dream.
>
> Although this solution works, I have no idea why. And I can't seem to find 
> the place in the source that refers to a Typed Factory being used. So my 
> question is twofold. Firstly, is this the correct way to configure Rhino 
> ServiceBus? And secondly (for my understanding), where and how is 
> the dependency on the Typed Factory occurring?
>
> Regards,
>
> Dion
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rhino-tools-dev/-/vKmJlKTK7L8J.
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