Skip to content

Commit 796abbc

Browse files
authored
Merge pull request #312 from jehiah/topology_hints_312
Set topology region+zone and send in IDENTIFY msg
2 parents 8098697 + 9982462 commit 796abbc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

config.go

+4
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ type Config struct {
139139
Hostname string `opt:"hostname"`
140140
UserAgent string `opt:"user_agent"`
141141

142+
// Topology hints allow nsqd to prefer same zone and same region consumers
143+
TopologyRegion string `opt:"topology_region"`
144+
TopologyZone string `opt:"topology_zone"`
145+
142146
// Duration of time between heartbeats. This must be less than ReadTimeout
143147
HeartbeatInterval time.Duration `opt:"heartbeat_interval" default:"30s"`
144148
// Integer percentage to sample the channel (requires nsqd 0.2.25+)

conn.go

+2
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ func (c *Conn) identify() (*IdentifyResponse, error) {
344344
ci["output_buffer_timeout"] = int64(c.config.OutputBufferTimeout / time.Millisecond)
345345
}
346346
ci["msg_timeout"] = int64(c.config.MsgTimeout / time.Millisecond)
347+
ci["topology_region"] = c.config.TopologyRegion
348+
ci["topology_zone"] = c.config.TopologyZone
347349
cmd, err := Identify(ci)
348350
if err != nil {
349351
return nil, ErrIdentify{err.Error()}

0 commit comments

Comments
 (0)