Go
The fluvio-go client is a community project put together by @avinassh.
It’s still under development but very exciting nonetheless!
To connect to the fluvio cluster do:
f, err := fluvio.Connect()
To create a TopicProducer
do:
producer, err := f.TopicProducer("hello-go")
To send into a topic do:
val := fmt.Sprintf("(from Go) %d (%s)", i, time.Now().String())
err = producer.SendString(fmt.Sprintf("%d", i), val)
To get a consumer, do:
partitionConsumer, err := f.PartitionConsumer("hello-go", 0)
To get a stream from the consumer do:
stream, err := partitionConsumer.Stream(fluvio.NewOffsetFromBeginning(0))
for {
r, err := stream.Next()
fmt.Printf("Got record: key=%s, value=%s\n", string(r.Key), string(r.Value))
}
Create a consumer config with the wasm file and get the filtered stream:
wasmFile := "example/filter.wasm"
config, err := fluvioClient.ConsumerConfigWithWasmFilter(wasmFile)
stream, err := partitionConsumer.StreamWithConfig(fluvio.NewOffsetFromBeginning(0), config)
for {
r, err := stream.Next()
fmt.Printf("Got record: key=%s, value=%s\n", string(r.Key), string(r.Value))
}