Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Fix bug in AbstractBootStrapper where ability to provide a config section (other than the default) was broken. + Moved castle consumer registration into an extension method for use outside the bootstrapper without copy-and-pasting.
- Loading branch information
1 parent
56f8c38
commit 214bc57
Showing
4 changed files
with
65 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,20 +1,43 @@ | |||
using Castle.Windsor; | using Castle.Windsor; | ||
using Rhino.ServiceBus.Castle; | using Rhino.ServiceBus.Castle; | ||
using Rhino.ServiceBus.Impl; | using Rhino.ServiceBus.Impl; | ||
|
|
||
namespace Rhino.ServiceBus | namespace Rhino.ServiceBus | ||
{ | { | ||
public static class Extensions | public static class Extensions | ||
{ | { | ||
public static AbstractRhinoServiceBusConfiguration UseCastleWindsor(this AbstractRhinoServiceBusConfiguration configuration) | public static AbstractRhinoServiceBusConfiguration UseCastleWindsor(this AbstractRhinoServiceBusConfiguration configuration) | ||
{ | { | ||
return UseCastleWindsor(configuration, new WindsorContainer()); | return UseCastleWindsor(configuration, new WindsorContainer()); | ||
} | } | ||
|
|
||
public static AbstractRhinoServiceBusConfiguration UseCastleWindsor(this AbstractRhinoServiceBusConfiguration configuration, IWindsorContainer container) | public static AbstractRhinoServiceBusConfiguration UseCastleWindsor(this AbstractRhinoServiceBusConfiguration configuration, IWindsorContainer container) | ||
{ | { | ||
new CastleBuilder(container, configuration); | new CastleBuilder(container, configuration); | ||
return configuration; | return configuration; | ||
} | } | ||
} |
|
||
public static void RegisterConsumersFrom(this IWindsorContainer container, Assembly assembly) | |||
{ | |||
RegisterConsumersFrom(container, assembly, x=>x.Named(x.Implementation.FullName)); | |||
} | |||
|
|||
public static void RegisterConsumersFrom(this IWindsorContainer container, Assembly assembly, Action<ComponentRegistration> configureConsumer) | |||
{ | |||
container.Register( | |||
AllTypes | |||
.FromAssembly(assembly) | |||
.Where(type => | |||
typeof(IMessageConsumer).IsAssignableFrom(type) && | |||
!typeof(IOccasionalMessageConsumer).IsAssignableFrom(type) && | |||
IsTypeAcceptableForThisBootStrapper(type) | |||
) | |||
.Configure(registration => | |||
{ | |||
registration.LifeStyle.Is(LifestyleType.Transient); | |||
configureConsumer(registration); | |||
}) | |||
); | |||
} | |||
} | |||
} | } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters