Ejemplo n.º 1
0
                $redisConfig += array('host' => '127.0.0.1', 'port' => 6379);
                if (extension_loaded('redis')) {
                    $redis = new \Redis();
                    $redis->connect($redisConfig['host'], $redisConfig['port']);
                } else {
                    $redis = new Predis\Client(['host' => $redisConfig['host'], 'port' => $redisConfig['port']]);
                    $redis->connect();
                }
                $emitter = new \SocketIO\Emitter($redis);
                if (isset($handler_config['namespace'])) {
                    $emitter->of($handler_config['namespace']);
                }
                if (isset($handler_config['room'])) {
                    $emitter->in($handler_config['room']);
                }
                $handler = new \CultuurNet\UDB3\Monolog\SocketIOEmitterHandler($emitter);
                break;
            default:
                continue 2;
        }
        $handler->setLevel($handler_config['level']);
        $logger->pushHandler($handler);
    }
    return $logger;
});
$app['event_command_bus'] = $app->share(function ($app) {
    $mainCommandBus = new \CultuurNet\UDB3\CommandHandling\SimpleContextAwareCommandBus();
    $commandBus = new \CultuurNet\UDB3\CommandHandling\ResqueCommandBus($mainCommandBus, 'event', $app['command_bus_event_dispatcher']);
    $commandBus->setLogger($app['logger.command_bus']);
    $commandBus->subscribe(new \CultuurNet\UDB3\Event\EventCommandHandler($app['event_repository'], $app['search_service']));
    $eventInfoService = new \CultuurNet\UDB3\EventExport\Format\HTML\Uitpas\EventInfo\CultureFeedEventInfoService($app['uitpas'], new \CultuurNet\UDB3\EventExport\Format\HTML\Uitpas\Promotion\EventOrganizerPromotionQueryFactory($app['clock']));
Ejemplo n.º 2
0
                $redisConfig += array('host' => '127.0.0.1', 'port' => 6379);
                if (extension_loaded('redis')) {
                    $redis = new \Redis();
                    $redis->connect($redisConfig['host'], $redisConfig['port']);
                } else {
                    $redis = new Predis\Client(['host' => $redisConfig['host'], 'port' => $redisConfig['port']]);
                    $redis->connect();
                }
                $emitter = new \SocketIO\Emitter($redis);
                if (isset($handler_config['namespace'])) {
                    $emitter->of($handler_config['namespace']);
                }
                if (isset($handler_config['room'])) {
                    $emitter->in($handler_config['room']);
                }
                $handler = new \CultuurNet\UDB3\Monolog\SocketIOEmitterHandler($emitter);
                break;
            default:
                continue 2;
        }
        $handler->setLevel($handler_config['level']);
        $handler->pushProcessor(new \Monolog\Processor\PsrLogMessageProcessor());
        $logger->pushHandler($handler);
    }
    return $logger;
});
$app['event_command_bus_base'] = function (Application $app) {
    $mainCommandBus = new \CultuurNet\UDB3\CommandHandling\SimpleContextAwareCommandBus();
    $commandBus = new \CultuurNet\UDB3\CommandHandling\ResqueCommandBus($mainCommandBus, 'event', $app['command_bus_event_dispatcher']);
    $commandBus->setLogger($app['logger.command_bus']);
    return $commandBus;