diff --git a/config.go b/config.go index b7d877ee..2c47a50c 100644 --- a/config.go +++ b/config.go @@ -139,6 +139,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+) diff --git a/conn.go b/conn.go index 8ec8a4ab..f7b822e4 100644 --- a/conn.go +++ b/conn.go @@ -344,6 +344,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()}