// topic 'addresses', of type string (we infer the type from the 2nd arg)
addresses := sync.NewTopic("addresses", "")
// listen on an random port
listener, _ := net.Listen("tcp", "0.0.0.0:0")
// instances publish their endpoint addresses on the 'addresses' topic
seq := client.MustPublish(ctx, addresses, listener.Addr().String())
fmt.Printf("I am instance number %d publishing to the 'addresses' topic\n", seq)
// consume all addresses from all peers
sub := client.MustSubscribe(ctx, topic, ch)
for i := 0; i < runenv.TestInstanceCount; i++ {
fmt.Println("received addr:", addr)
// we cancel the context we passed to the subscription