Skip to content

Commit

Permalink
More docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
cswank committed Jan 18, 2019
1 parent b4e3b77 commit eeadd82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ for example:
Assuming the messages that get printed are JSON, this print the sum of all age fields
from each message in the partition.

### Custom Decoder
If your kafka messages are encoded in some way you can provide a custom decoder
in the form of a plugin. See plugins/protobuf for an example. Once you have
compiled the plugin you use it as the default decoder by starting kcli like so:

kcli -d /path/to/your/decoder.so

### Screen Colors

If you don't like the defaul colors you can set KCLI_COLOR[0,1,2,3] to one of:
Expand Down
7 changes: 6 additions & 1 deletion plugins/protobuf/protobuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (
"github.com/golang/protobuf/proto"
)

// Example of how to create a protobuf plugin for your data structure
// Protobuf is an example of how to create a plugin
// to decode protobuf encoded kafka messages.
// To compile:
// go build -buildmode=plugin -o protobuf.so protobuf.go
// Then start kcli like:
// kcli -d ./protobuf.so
type Protobuf struct{}

func (p Protobuf) Decode(b []byte) ([]byte, error) {
Expand Down

0 comments on commit eeadd82

Please sign in to comment.