Skip to content

Commit

Permalink
replicator: make client id descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Dec 5, 2016
1 parent 18c4e94 commit 22b8a88
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions replicator/partition_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package replicator

import (
"bytes"
"fmt"
"io"
"math/rand"

Expand All @@ -23,16 +24,19 @@ type Options struct {
type PartitionReplicator struct {
*Options
highwaterMarkOffset int64
clientID string
offset int64
msgs chan []byte
done chan struct{}
}

func NewPartitionReplicator(options *Options) (*PartitionReplicator, error) {
clientID := fmt.Sprintf("Partition Replicator for Broker/Topic/Partition: [%d/%s/%d]", options.Partition.Leader.ID, options.Partition.Topic, options.Partition.Partition)
return &PartitionReplicator{
Options: options,
done: make(chan struct{}, 2),
msgs: make(chan []byte, 2),
Options: options,
clientID: clientID,
done: make(chan struct{}, 2),
msgs: make(chan []byte, 2),
}, nil
}

Expand Down Expand Up @@ -60,7 +64,7 @@ func (r *PartitionReplicator) fetchMessages() error {
}
var req protocol.Encoder = &protocol.Request{
CorrelationID: rand.Int31(),
ClientID: "client_id",
ClientID: r.clientID,
Body: fetchBody,
}
b, err := protocol.Encode(req)
Expand Down

0 comments on commit 22b8a88

Please sign in to comment.