for count < 5 {
responseFn := func(m *M.Message) {
Convey("Testing Response received on Publish message", t, func() {
So(m.Status, ShouldEqual, M.OK)
So(m.Event, ShouldEqual, "MSG_ACK")
slog.Printf("Response: %v", m)
})
}
args[0] = h.Id.String() // HubId
args[1] = h.GetIPAddress() // host hostname
for i := 0; i < hub.NO_OF_COLLECTOR; i++ {
args[i+2] = collectorPorts[i] // host listening port
}
m.Args = args
m.Msg = msg[count]
m.Id = M.Uid(count)
env := transport.Envelope{
Data: m,
Tm: time.Now(),
}
req := transport.DynamicDealerMsg{
Env: env,
ResponseFn: responseFn,
}
h2dd <- req
slog.Println("count", count, req.Env.Data)
count++
}
time.Sleep(time.Second * 5)
}
Here I am writing 5 requests to channel.At the end channel has 5 requests but not what I sent.All requests are replaced with last request I sent.Why it is happening I am unable to figure it out.Any suggestions..