Skip to content

Commit

Permalink
Set topology region+zone and send in IDENTIFY msg
Browse files Browse the repository at this point in the history
  • Loading branch information
jehiah committed May 24, 2024
1 parent c2c3842 commit 9982462
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ type Config struct {
Hostname string `opt:"hostname"`
UserAgent string `opt:"user_agent"`

// Topology hints allow nsqd to prefer same zone and same region consumers
TopologyRegion string `opt:"topology_region"`
TopologyZone string `opt:"topology_zone"`

// Duration of time between heartbeats. This must be less than ReadTimeout
HeartbeatInterval time.Duration `opt:"heartbeat_interval" default:"30s"`
// Integer percentage to sample the channel (requires nsqd 0.2.25+)
Expand Down
2 changes: 2 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ func (c *Conn) identify() (*IdentifyResponse, error) {
ci["output_buffer_timeout"] = int64(c.config.OutputBufferTimeout / time.Millisecond)
}
ci["msg_timeout"] = int64(c.config.MsgTimeout / time.Millisecond)
ci["topology_region"] = c.config.TopologyRegion
ci["topology_zone"] = c.config.TopologyZone
cmd, err := Identify(ci)
if err != nil {
return nil, ErrIdentify{err.Error()}
Expand Down

0 comments on commit 9982462

Please sign in to comment.