ytake / php-ksql

Apache Kafka / Confluent KSQL REST Client for PHP
MIT License
18 stars 2 forks source link

Feature/added properties #4

Closed ytake closed 5 years ago

ytake commented 5 years ago

Added LocalProperty

KSQL

streamsProperties (map) – Property overrides to run the statements with.

Example

<?php
declare(strict_types=1);

use Istyle\KsqlClient\StreamClient;
use Istyle\KsqlClient\Query\Stream;
use Istyle\KsqlClient\StreamConsumable;
use Istyle\KsqlClient\Entity\StreamedRow;
use Istyle\KsqlClient\Properties\LocalProperties;
use Istyle\KsqlClient\Properties\LocalPropertyValidator;

$client = new StreamClient(
    "http://localhost:8088"
);
$properties = new LocalProperties(["ksql.streams.auto.offset.reset" => "earliest"], new LocalPropertyValidator());

$result = $client->requestQuery(
    new Stream(
        'SELECT * FROM testing',
        new class() implements StreamConsumable
        {
            public function __invoke(StreamedRow $row)
            {
                // stream response consumer
            }
        }
    ),
    $properties
)->result();
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 28


Totals Coverage Status
Change from base Build 25: 2.4%
Covered Lines: 464
Relevant Lines: 503

💛 - Coveralls