}); $app['event_history_cache'] = $app->share(function (Application $app) { return $app['cache']('event_history'); }); /** * Factory method for instantiating a UDB2 related logger with the specified * name. */ $app['udb2_logger'] = $app->share(function (Application $app) { return function ($name) use($app) { $logger = new \Monolog\Logger($name, [$app['udb2_log_handler']]); return $logger; }; }); $app['event_bus'] = $app->share(function ($app) { $eventBus = new \CultuurNet\UDB3\SimpleEventBus(); $eventBus->beforeFirstPublication(function (\Broadway\EventHandling\EventBusInterface $eventBus) use($app) { // Subscribe projector for event relations read model as the first one. $eventBus->subscribe($app['relations_projector']); $eventBus->subscribe($app['search_cache_manager']); // Subscribe projector for the JSON-LD read model. $eventBus->subscribe($app['event_jsonld_projector']); // Subscribe event importer which will listen for event creates and // updates coming from UDB2 and create/update the corresponding // event in our repository as well. $eventBus->subscribe($app['udb2_event_importer']); // Subscribe event history projector. $eventBus->subscribe($app['event_history_projector']); // Subscribe Place JSON-LD projector. $eventBus->subscribe($app['place_jsonld_projector']); // Subscribe Organizer JSON-LD projector.
}); $app['place_relations_projector'] = $app->share(function ($app) { return new \CultuurNet\UDB3\Place\ReadModel\Relations\Projector($app['place_relations_repository']); }); $app['event_history_projector'] = $app->share(function ($app) { $projector = new \CultuurNet\UDB3\Event\ReadModel\History\HistoryProjector($app['event_history_repository']); return $projector; }); $app['event_history_repository'] = $app->share(function ($app) { return new \CultuurNet\UDB3\Doctrine\Event\ReadModel\CacheDocumentRepository($app['event_history_cache']); }); $app['event_history_cache'] = $app->share(function (Application $app) { return $app['cache']('event_history'); }); $app['event_bus'] = $app->share(function ($app) { $eventBus = new \CultuurNet\UDB3\SimpleEventBus(); $eventBus->beforeFirstPublication(function (\Broadway\EventHandling\EventBusInterface $eventBus) use($app) { $subscribers = ['search_cache_manager', 'event_relations_projector', 'place_relations_projector', 'event_jsonld_projector', 'event_history_projector', 'place_jsonld_projector', 'organizer_jsonld_projector', 'organizer_search_projector', 'event_calendar_projector', 'variations.search.projector', 'variations.jsonld.projector', 'index.projector', 'event_permission.projector', 'place_permission.projector', 'amqp.publisher', 'udb2_events_cdbxml_enricher', 'udb2_actor_events_cdbxml_enricher', 'udb2_events_to_udb3_place_applier', 'udb2_events_to_udb3_event_applier', 'udb2_actor_events_to_udb3_place_applier', 'udb2_actor_events_to_udb3_organizer_applier', 'udb2_label_importer', 'place_permission.projector', LabelServiceProvider::JSON_PROJECTOR, LabelServiceProvider::RELATIONS_PROJECTOR, LabelServiceProvider::EVENT_LABEL_PROJECTOR, LabelServiceProvider::PLACE_LABEL_PROJECTOR, LabelServiceProvider::ORGANIZER_LABEL_PROJECTOR, LabelServiceProvider::RELATIONS_PROJECTOR, LabelServiceProvider::LABEL_ROLES_PROJECTOR, 'role_detail_projector', 'role_labels_projector', 'label_roles_projector', 'role_search_projector', 'role_users_projector', 'user_roles_projector', UserPermissionsServiceProvider::USER_PERMISSIONS_PROJECTOR]; // Allow to override event bus subscribers through configuration. // The event replay command line utility uses this. if (isset($app['config']['event_bus']) && isset($app['config']['event_bus']['subscribers'])) { $subscribers = $app['config']['event_bus']['subscribers']; } foreach ($subscribers as $subscriberServiceId) { $eventBus->subscribe($app[$subscriberServiceId]); } }); return $eventBus; }); $app['events_locator_event_stream_decorator'] = $app->share(function (Application $app) { return new OfferLocator($app['event_iri_generator']);