Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mongey/ksql
A barebones go client for interacting with Confluent's KSQL Server
https://github.com/mongey/ksql
kafka ksql
Last synced: about 2 months ago
JSON representation
A barebones go client for interacting with Confluent's KSQL Server
- Host: GitHub
- URL: https://github.com/mongey/ksql
- Owner: Mongey
- Created: 2018-05-08T21:28:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-03T23:56:47.000Z (almost 5 years ago)
- Last Synced: 2024-11-02T07:51:43.364Z (2 months ago)
- Topics: kafka, ksql
- Language: Go
- Size: 3.93 MB
- Stars: 13
- Watchers: 3
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# KSQL go client
[![GoDoc](https://godoc.org/github.com/Mongey/ksql/ksql?status.svg)][godoc]
[![CircleCI](https://circleci.com/gh/Mongey/ksql.svg?style=svg)][ci]A barebones go client for interacting with [Confluent's KSQL][ksql]
## Examples
#### List all Streams
```go
c := ksql.NewClient("http://localhost:8088")
log.Println("=>>> Streams")
streams, err := c.ListStreams()
if err != nil {
log.Fatal(err)
}
for i, v := range streams {
log.Printf("Stream %d: %s", i, v.Name)
}
```#### List all Tables
```go
c := ksql.NewClient("http://localhost:8088")
log.Println("=>>> Tables")
tables, err := c.ListTables()
if err != nil {
log.Fatal(err)
}
for i, v := range tables {
log.Printf("Table %d: %s", i, v.Name)
}
```#### Query stream
```go
c := ksql.NewClient("http://localhost:8088")
log.Println("=>>> Forever Query :")
ch := make(chan *ksql.QueryResponse)
go c.Query(ksql.Request{KSQL: "SELECT pageid FROM pageviews_original;"}, ch)
for {
select {
case msg := <-ch:
log.Println(msg.Row)
}
}
```
[godoc]: https://godoc.org/github.com/Mongey/ksql/ksql
[ksql]: https://www.confluent.io/product/ksql/
[ci]: https://circleci.com/gh/Mongey/ksql