Question

To link up my MEF application, I'm using the event aggregator found here. Its been perfect for distributing data into modules that actually need it.

I'm getting more into using the reactive extensions and I've been trying to do the following:

eventSubscription = MainApp.Events.GetEvent<UDPMessageIn>()
                                  .BufferWithTime(TimeSpan.FromSeconds(1))
                                  .Subscribe(x => 
                                       { 
                                           // do something here...
                                       });

However, the event aggregator appears to hang in the Publish method on:

((ISubject<TEvent>)subject).OnNext(sampleEvent);

I'm guessing that there's something about the design of either system.reactive or the aggregator that I don't fully understand. Anybody got any ideas?

Was it helpful?

Solution 2

It turned out to be a threading issue that was unrelated to Rx or the event aggregator.

Changing one of my UI Invokes to BeginInvoke stopped it from hanging and this got me looking at the right bits of code...

OTHER TIPS

What threads are both the producer and consumer running on? Are they separate?

Try:

.BufferWithTime(TimeSpan.FromSeconds(1), Scheduler.TaskPool);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top