A Circuit Breaker Which Trips On Frequency Of Failures

@Jez tweeted last night: @ianfnelson admit it: you use Castle Windsor primarily to highlight and lampoon Google’s poor selection of adwords?! — 𝚂𝚑𝚘𝚘𝚝𝚒𝚗𝚐 𝚂𝚌𝚒𝚕𝚕𝚢 (@shootingscilly) October 26, 2009 Funny, but not true. I am enamoured with the Castle Windsor project because its power makes it fairly simple for me to develop loosely-coupled systems which are easily maintained and tested. The wide range of Facilities and Contrib projects also integrate nicely with the other parts of my current development stack (NHibernate, WCF, WF, log4net). ...

28 October 2009

Castle Windsor Array Resolution Gotcha

The shiny new system which I’ve recently been developing makes heavy use of the Chain of Responsibility pattern, and as such a number of service classes take an array of objects in the constructor: I’m using Castle Windsor for dependency management, so I’ve been fluently registering all instances of ILeadAllocator: Easy, right? And yet at runtime Windsor surprised me by throwing this exception in my face: Castle.MicroKernel.Handlers.HandlerException: Can’t create component ‘Marshalls.Leads.ApplicationService.LeadAllocationService’ as it has dependencies to be satisfied. Marshalls.Leads.ApplicationService.LeadAllocationService is waiting for the following dependencies: Keys (components with specific keys) – leadAllocators which was not registered. Huh?! What gives? Well, a little Googling revealed this post from Castle founder Hamilton Verissimo explaining that by default the Castle MicroKernel expects me to define what should be included in the array. But he goes on to explain that the behaviour I desire can be achieved by registering a custom subresolver with the microkernel. That subresolver has since been included in the Castle Windsor distro, so in actual fact all I needed to do was add the following line of code when configuring my container: ...

26 October 2009

Castle Windsor Lifestyle Gotcha

I always knew my lifestyle choices would come back to bite me some day… I’ve been making heavy use of the Castle Windsor container to handle dependency and configuration management in the shiny new system that I’m currently developing. For the most part it’s been an absolute blast, allowing me to easily create a loosely-coupled system architecture and focus my efforts on what the system should be achieving for the client, rather than worrying about how it all hangs together. ...

19 October 2009