Skip to content

Commit

Permalink
Shitty containers and race conditions suck ass
Browse files Browse the repository at this point in the history
  • Loading branch information
phatboyg committed Mar 29, 2012
1 parent 1cd9b6d commit e14a23b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Containers/MassTransit.Containers.Tests/Ninject_Specs.cs
Expand Up @@ -23,6 +23,7 @@ public class Ninject_Consumer :
When_registering_a_consumer When_registering_a_consumer
{ {
readonly IKernel _container; readonly IKernel _container;
SimpleConsumer _simpleConsumer;


public Ninject_Consumer() public Ninject_Consumer()
{ {
Expand All @@ -33,6 +34,8 @@ public Ninject_Consumer()
_container.Bind<AnotherMessageConsumer>() _container.Bind<AnotherMessageConsumer>()
.To<AnotherMessageConsumerImpl>() .To<AnotherMessageConsumerImpl>()
.InSingletonScope(); .InSingletonScope();

_simpleConsumer = _container.Get<SimpleConsumer>();
} }


[Finally] [Finally]
Expand All @@ -45,12 +48,12 @@ protected override void SubscribeLocalBus(SubscriptionBusServiceConfigurator sub
{ {
// we have to do this explicitly, since the metadata is not exposed by Ninject // we have to do this explicitly, since the metadata is not exposed by Ninject
subscriptionBusServiceConfigurator.Consumer<SimpleConsumer>(_container); subscriptionBusServiceConfigurator.Consumer<SimpleConsumer>(_container);
subscriptionBusServiceConfigurator.Consumer<AnotherMessageConsumerImpl>(_container); subscriptionBusServiceConfigurator.Consumer<AnotherMessageConsumer>(_container);
} }


protected override SimpleConsumer GetSimpleConsumer() protected override SimpleConsumer GetSimpleConsumer()
{ {
return _container.Get<SimpleConsumer>(); return _simpleConsumer;
} }
} }


Expand Down
Expand Up @@ -24,6 +24,8 @@ public class AnotherMessageConsumerImpl :


public AnotherMessageConsumerImpl() public AnotherMessageConsumerImpl()
{ {
Console.WriteLine("AnotherMessageConsumer()");

_received = new ManualResetEvent(false); _received = new ManualResetEvent(false);
} }


Expand Down
Expand Up @@ -24,6 +24,8 @@ public class SimpleConsumer :


public SimpleConsumer() public SimpleConsumer()
{ {
Console.WriteLine("SimpleConsumer()");

_received = new ManualResetEvent(false); _received = new ManualResetEvent(false);
} }


Expand Down

1 comment on commit e14a23b

@ahjohannessen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for awesome commit message :D

Btw, just started doing CQRS with EventStore and MassTransit!

Please sign in to comment.