Currently, EventBusFactory is a Service. EventBusFactory can be used to instantiate EventBus instances.
The reasons for having multiple EventBus instances are:
- Different destination_event_service for each stream, and each EventBus can only send to one url.
- Different configurations for EventServices, e.g. timeout, etc. so each EventBus needs these configurations.
EventBus allows disabling of entire 'types' of events for a whole wiki via the EnableEventBus config bitmask. In T259712: Allow disabling/enabling configured streams via wgEventStreams config, we added the ability to disable individual streams via EventStreamConfig by routing disabled streams to a 'null EventBus' instance that is configured to allow TYPE_NONE. All events sent through it will just be dropped. This was always a bit of a hack.
It would be clearer if EventBus itself used EventStreamConfig to determine if an event stream is disabled. If it has a StreamConfigs property, it there is no reason it also couldn't have access the EventServices config. With all this info, it could also determine which event service a stream should be sent to.
In 2024-07 @Ottomata explored this refactor in these WIP unfinished patches.
- Use StreamConfigs to determine if an event should be sent in EventBus send function. (1053785)
- WIP - Refactor EventBus to be a Service (1054934)
This was done while considering implementation for T346046: [Search Update Pipeline] Source streams for private wikis, as that ticket relies heavily on the per stream disabling feature (which is a currently a bit awkward). See T346046#9998083 for some context.