php ksql
changed namespace
Apache kafka / Cliente REST KSQL Confluent para php
KSQL é o mecanismo SQL de streaming para Apache Kafka.
O que é KSQL?
obrigatório >= PHP 7.1
$ composer require ytake/php-ksql
aula |
---|
YtakeKsqlClientQueryCommandStatus |
YtakeKsqlClientQueryStatus |
YtakeKsqlClientQueryServerInfo |
YtakeKsqlClientQueryKsql |
YtakeKsqlClientQueryStream (para fluxo) |
Referência de sintaxe
<?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 ();