Permalink
Browse files

Shitty containers and race conditions suck ass

  • Loading branch information...
1 parent 1cd9b6d commit e14a23be7596099d7f48236e8358c67aec93e05b @phatboyg phatboyg committed Mar 29, 2012
@@ -23,6 +23,7 @@ public class Ninject_Consumer :
When_registering_a_consumer
{
readonly IKernel _container;
+ SimpleConsumer _simpleConsumer;
public Ninject_Consumer()
{
@@ -33,6 +34,8 @@ public Ninject_Consumer()
_container.Bind<AnotherMessageConsumer>()
.To<AnotherMessageConsumerImpl>()
.InSingletonScope();
+
+ _simpleConsumer = _container.Get<SimpleConsumer>();
}
[Finally]
@@ -45,12 +48,12 @@ protected override void SubscribeLocalBus(SubscriptionBusServiceConfigurator sub
{
// we have to do this explicitly, since the metadata is not exposed by Ninject
subscriptionBusServiceConfigurator.Consumer<SimpleConsumer>(_container);
- subscriptionBusServiceConfigurator.Consumer<AnotherMessageConsumerImpl>(_container);
+ subscriptionBusServiceConfigurator.Consumer<AnotherMessageConsumer>(_container);
}
protected override SimpleConsumer GetSimpleConsumer()
{
- return _container.Get<SimpleConsumer>();
+ return _simpleConsumer;
}
}
@@ -24,6 +24,8 @@ public class AnotherMessageConsumerImpl :
public AnotherMessageConsumerImpl()
{
+ Console.WriteLine("AnotherMessageConsumer()");
+
_received = new ManualResetEvent(false);
}
@@ -24,6 +24,8 @@ public class SimpleConsumer :
public SimpleConsumer()
{
+ Console.WriteLine("SimpleConsumer()");
+
_received = new ManualResetEvent(false);
}

1 comment on commit e14a23b

+1 for awesome commit message :D

Btw, just started doing CQRS with EventStore and MassTransit!

Please sign in to comment.