Skip to content

Commit

Permalink
switch to latest upstream sarama
Browse files Browse the repository at this point in the history
our admin changes are now included :)
  • Loading branch information
birdayz committed Feb 16, 2019
1 parent 067380a commit 19b9a5a
Show file tree
Hide file tree
Showing 544 changed files with 249,240 additions and 373 deletions.
4 changes: 2 additions & 2 deletions cmd/kaf/consume.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

"text/tabwriter"

"github.com/birdayz/sarama"
"github.com/hokaccha/go-prettyjson"
"github.com/Shopify/sarama"
prettyjson "github.com/hokaccha/go-prettyjson"
"github.com/spf13/cobra"
)

Expand Down
58 changes: 37 additions & 21 deletions cmd/kaf/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (

"sync"

sarama "github.com/birdayz/sarama"
"github.com/infinimesh/kaf"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"

"github.com/infinimesh/kaf"
)

func init() {
Expand All @@ -38,8 +39,7 @@ const (
tabwriterFlags = 0
)

var groupCmd = &cobra.Command{
Use: "group",
var groupCmd = &cobra.Command{Use: "group",
Short: "Display information about consumer groups.",
}

Expand Down Expand Up @@ -80,25 +80,36 @@ var groupLsCmd = &cobra.Command{
}

found := false
for _, group := range groupList {
if len(args) > 0 {
if group == args[0] {
found = true
} else {
continue
}
}

detail, err := admin.DescribeConsumerGroup(group)
if err != nil {
panic(err)
}
// for _, group := range groupList {
// if len(args) > 0 {
// if group == args[0] {
// found = true
// } else {
// continue
// }
// }

// detail, err := admin.DescribeConsumerGroup(group)
// if err != nil {
// panic(err)
// }

// state := detail.State
// consumers := len(detail.Members)

// fmt.Fprintf(w, "%v\t%v\t%v\t\n", group, state, consumers)
// found = true
// }

groupDescs, err := admin.DescribeConsumerGroups(groupList)
if err != nil {
panic(err)
}

for _, detail := range groupDescs {
state := detail.State
consumers := len(detail.Members)

fmt.Fprintf(w, "%v\t%v\t%v\t\n", group, state, consumers)
found = true
fmt.Fprintf(w, "%v\t%v\t%v\t\n", detail.GroupId, state, consumers)
}

if found || len(args) == 0 {
Expand All @@ -123,11 +134,16 @@ var groupDescribeCmd = &cobra.Command{
panic(err)
}

group, err := admin.DescribeConsumerGroup(args[0])
groups, err := admin.DescribeConsumerGroups([]string{args[0]})
if err != nil {
panic(err)
}

if len(groups) == 0 {
panic("Did not receive expected describe consumergroup result")
}
group := groups[0]

if group.State == "Dead" {
fmt.Printf("Group %v not found.\n", args[0])
return
Expand Down
5 changes: 3 additions & 2 deletions cmd/kaf/kaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (

"os"

sarama "github.com/birdayz/sarama"
"github.com/infinimesh/kaf"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"

"github.com/infinimesh/kaf"
)

var cfgFile string
Expand Down
2 changes: 1 addition & 1 deletion cmd/kaf/produce.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"os"

sarama "github.com/birdayz/sarama"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/kaf/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"
"text/tabwriter"

sarama "github.com/birdayz/sarama"
"github.com/Shopify/sarama"
"github.com/spf13/cobra"
)

Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module github.com/infinimesh/kaf

require (
github.com/DataDog/zstd v1.3.5 // indirect
github.com/Shopify/sarama v1.20.2-0.20190215145417-6a7bac87a052
github.com/Shopify/toxiproxy v2.1.3+incompatible // indirect
github.com/birdayz/sarama v1.18.1-0.20181002235130-f4ecd70fafef
github.com/chzyer/logex v1.1.10 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
Expand Down
8 changes: 6 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
github.com/DataDog/zstd v1.3.5 h1:DtpNbljikUepEPD16hD4LvIcmhnhdLTiW/5pHgbmp14=
github.com/DataDog/zstd v1.3.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Shopify/sarama v1.20.1 h1:Bb0h3I++r4eX333Y0uZV2vwUXepJbt6ig05TUU1qt9I=
github.com/Shopify/sarama v1.20.1/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/sarama v1.20.2-0.20190215145417-6a7bac87a052 h1:VC2i78PjcLvo3mVXBXupPYsq3a4Ev/xQ8sB+SNr43TU=
github.com/Shopify/sarama v1.20.2-0.20190215145417-6a7bac87a052/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.3+incompatible h1:awiJqUYH4q4OmoBiRccJykjd7B+w0loJi2keSna4X/M=
github.com/Shopify/toxiproxy v2.1.3+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/birdayz/sarama v1.18.1-0.20181002235130-f4ecd70fafef h1:rVSyBkgpXt+FxoIQ68iRh/aBfCYaPjyYuJI2joSVoxM=
github.com/birdayz/sarama v1.18.1-0.20181002235130-f4ecd70fafef/go.mod h1:b5a7snSTcZdb6pJI1mc6FVHchD3/YiOt+85VDpLfArg=
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
Expand Down
30 changes: 30 additions & 0 deletions vendor/github.com/DataDog/zstd/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions vendor/github.com/DataDog/zstd/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 120 additions & 0 deletions vendor/github.com/DataDog/zstd/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions vendor/github.com/DataDog/zstd/ZSTD_LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 19b9a5a

Please sign in to comment.