php ksql
changed namespace
Apache kafka / Confluent KSQL REST ไคลเอ็นต์สำหรับ php.ini
KSQL เป็นเครื่องมือสตรีมมิ่ง SQL สำหรับ Apache Kafka
KSQL คืออะไร?
จำเป็น >= PHP 7.1
$ composer require ytake/php-ksql
ระดับ |
---|
YtakeKsqlClientQueryCommandStatus |
YtakeKsqlClientQueryStatus |
YtakeKsqlClientQueryServerInfo |
YtakeKsqlClientQueryKsql |
YtakeKsqlClientQueryStream (สำหรับสตรีม) |
การอ้างอิงไวยากรณ์
<?php
use Ytake KsqlClient RestClient ;
use Ytake KsqlClient Query CommandStatus ;
use Ytake KsqlClient Computation CommandId ;
$ client = new RestClient (
" http://localhost:8088 "
);
$ result = $ client -> requestQuery (
new CommandStatus (CommandId:: fromString ( ' stream/MESSAGE_STREAM/create ' ))
)-> result ();
<?php
use Ytake KsqlClient RestClient ;
use Ytake KsqlClient Query Status ;
$ client = new RestClient (
" http://localhost:8088 "
);
$ result = $ client -> requestQuery ( new Status ())-> result ();
<?php
use Ytake KsqlClient RestClient ;
use Ytake KsqlClient Query ServerInfo ;
$ client = new RestClient (
" http://localhost:8088 "
);
$ result = $ client -> requestQuery ( new ServerInfo ())-> result ();
<?php
use Ytake KsqlClient RestClient ;
use Ytake KsqlClient Query Ksql ;
$ client = new RestClient (
" http://localhost:8088 "
);
$ result = $ client -> requestQuery (
new Ksql ( ' DESCRIBE users_original; ' )
)-> result ();
<?php
use Ytake KsqlClient StreamClient ;
use Ytake KsqlClient Query Stream ;
use Ytake KsqlClient StreamConsumable ;
use Ytake KsqlClient Entity StreamedRow ;
$ client = new StreamClient (
" http://localhost:8088 "
);
$ result = $ client -> requestQuery (
new Stream (
' SELECT * FROM testing ' ,
new class () implements StreamConsumable {
public function __invoke ( StreamedRow $ row )
{
// stream response consumer
}
}
)
)-> result ();