Skip to content

Commit

Permalink
Merge pull request #41 from yinheli/bugfix/subscribe-filter
Browse files Browse the repository at this point in the history
fix: subscribe filter not work expected
  • Loading branch information
withlin authored Nov 10, 2019
2 parents 2db66ad + e1c5383 commit b68e735
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions client/simple_canal_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func (c *SimpleCanalConnector) Subscribe(filter string) error {
if !c.Running {
return nil
}
body, _ := proto.Marshal(&pb.Sub{Destination: c.ClientIdentity.Destination, ClientId: strconv.Itoa(c.ClientIdentity.ClientId), Filter: c.Filter})
body, _ := proto.Marshal(&pb.Sub{Destination: c.ClientIdentity.Destination, ClientId: strconv.Itoa(c.ClientIdentity.ClientId), Filter: filter})
pack := new(pb.Packet)
pack.Type = pb.PacketType_SUBSCRIPTION
pack.Body = body
Expand All @@ -445,13 +445,12 @@ func (c *SimpleCanalConnector) Subscribe(filter string) error {
}

if ack.GetErrorCode() > 0 {

panic(errors.New(fmt.Sprintf("failed to subscribe with reason::%s", ack.GetErrorMessage())))
return fmt.Errorf("failed to subscribe with reason::%s", ack.GetErrorMessage())
}

c.Filter = filter
return nil

return nil
}

//waitClientRunning 等待客户端跑
Expand Down

0 comments on commit b68e735

Please sign in to comment.