To avoid that listeners miss events broadcast before the got a change to register themselves with the event bus, the bus needs to queue events until an explicit start message is received.
Before the EventBus#start method has been called, the EventBus will queue broadcast events, and then pass them on to the handlers when EventBus#start is called.
After the EventBus#start method has been called, the EventBus immediately pass on broadcast event to the handlers.
Is needed for fix of cucumber/cucumber-ruby#1041, see cucumber/cucumber-ruby#1059.
Rspec specs have been updated to cover the changed functionality.
Queue the events in the event bus before the bus is started.
To avoid that listeners miss events broadcast before the got a change
to register themselves with the event bus, the bus needs to queue
events until an exeplicit start message is received.
@brasmusson I finally had a chance to get my head around this change. I had a think about it, and I wonder if it might be simpler, rather than having an explicit start method, to just queue all events, and automatically replay any queued events to new subscribers as they register. WDYT?
I had a play with that idea here: https://github.com/cucumber/cucumber-ruby-core/compare/event-bus-queue-alternative
Would it work?
@mattwynne Yes the event-bus-queue-alternative should work - with it I have managed to verify that cucumber/cucumber-ruby#1041 would disappear with it. What I still would change in Cucumber-Ruby from cucumber/cucumber-ruby#1059 is most of the changes in runtime.rb - reverting the changes from cucumber/cucumber-ruby#977 in runtime.rb to be exact - delaying the loading of step definitions until the formatters are created which was introduced there - does not make any sense any more.