Fix passing index to client
This commit is contained in:
parent
229766036d
commit
1f8b369266
|
@ -139,7 +139,7 @@ func (c *Client) Publish(topic, message string) error {
|
|||
}
|
||||
|
||||
// Subscribe ...
|
||||
func (c *Client) Subscribe(topic string, index int, handler msgbus.HandlerFunc) *Subscriber {
|
||||
func (c *Client) Subscribe(topic string, index int64, handler msgbus.HandlerFunc) *Subscriber {
|
||||
return NewSubscriber(c, topic, index, handler)
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ type Subscriber struct {
|
|||
client *Client
|
||||
|
||||
topic string
|
||||
index int
|
||||
index int64
|
||||
|
||||
handler msgbus.HandlerFunc
|
||||
|
||||
|
@ -162,7 +162,7 @@ type Subscriber struct {
|
|||
}
|
||||
|
||||
// NewSubscriber ...
|
||||
func NewSubscriber(client *Client, topic string, index int, handler msgbus.HandlerFunc) *Subscriber {
|
||||
func NewSubscriber(client *Client, topic string, index int64, handler msgbus.HandlerFunc) *Subscriber {
|
||||
if handler == nil {
|
||||
handler = noopHandler
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ func NewSubscriber(client *Client, topic string, index int, handler msgbus.Handl
|
|||
|
||||
u.Path += fmt.Sprintf("/%s", topic)
|
||||
q := u.Query()
|
||||
q.Set("index", strconv.Itoa(index))
|
||||
q.Set("index", strconv.FormatInt(index, 10))
|
||||
u.RawQuery = q.Encode()
|
||||
|
||||
url := u.String()
|
||||
|
|
|
@ -36,7 +36,7 @@ reset to zero on message bus restarts.`,
|
|||
client := client.NewClient(uri, nil)
|
||||
|
||||
topic := args[0]
|
||||
index := viper.GetInt("index")
|
||||
index := viper.GetInt64("index")
|
||||
|
||||
var (
|
||||
command string
|
||||
|
@ -101,7 +101,7 @@ func handler(command string, args []string) msgbus.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func subscribe(client *client.Client, topic string, index int, command string, args []string) {
|
||||
func subscribe(client *client.Client, topic string, index int64, command string, args []string) {
|
||||
if topic == "" {
|
||||
topic = defaultTopic
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue