Closed marcomicera closed 3 years ago
We could use KubeMQ's "long polling" feature with a timeout (e.g., 60 seconds) in a for
loop, kinda like it's done in Java with wait()
to handle spurious wakeups.
So it'd be something like:
for {
res, err := client.NewReceiveQueueMessagesRequest().
SetChannel(channel).
SetMaxNumberOfMessages(1).
SetWaitTimeSeconds(60).
Send(ctx)
if err != nil {
log.Fatal(err)
}
if res != nil && res.MessagesReceived != 0 {
break
}
}
But the name suggests that it's polling anyway, so not that great.
Closing, as we're not gonna be using KubeMQ anymore.
Such a call:
Returns immediately with:
This is not the behavior we want in Quartermaster: modules should start and block on the queue until their message has been inserted in the queue by the master.