<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class StreamSubscriberConsumeCommand extends AbstractCommand
{
    public function name(): string { return 'stream:subscriber:consume'; }
    public function description(): string { return 'PPphp Stream Subscriber Consume'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Stream Subscriber Consume');
        $base = \PpPhp\Core\Platform\Console\ConsolePath::basePath(); $runtime = \PpPhp\Core\Platform\Event\Streaming\Subscriber\StreamSubscriberRuntime::instance($base); $runtime->register('subscriber.console', 'console.stream'); $result = $runtime->consume('subscriber.console', 10, true); $this->line('Consumed: ' . $result->consumed()); $this->line('Acknowledged: ' . $result->acknowledged());
        return 0;
    }
}
