You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MessagesContext provides an interface to retrieve the next message in a queue. This can be stopped/cancelled by calling Stop() on it.
The Next() func on the MesssagesContext blocks indefinitely. This can be a problem if you're reading messages in a loop and need to be able to cancel this work with a context.Context. I can't see any way to pass a context.Context to Next() nor when instantiating the MessagesContext.
I see that MessagesContext can be instantiated with the PullExpiry opt, but I don't think this actually solves my problem.
I'm using this over Fetch because of what it says in the docs, though it's worth noting the Fetch() API does not support context.Context either:
Warning: Both Fetch() and FetchNoWait() have worse performance when used to continuously retrieve messages in comparison to Messages() or Consume() methods, as they do not perform any optimizations (pre-buffering) and new subscription is created for each execution.
Use case
As above.
Contribution
No response
The text was updated successfully, but these errors were encountered:
Hello @cedws, @zhulik. Thanks for creating the issue - we're working on enabling passing context to those methods, I'll update you in this issue when we have a PR.
Proposed change
MessagesContext
provides an interface to retrieve the next message in a queue. This can be stopped/cancelled by callingStop()
on it.The
Next()
func on theMesssagesContext
blocks indefinitely. This can be a problem if you're reading messages in a loop and need to be able to cancel this work with acontext.Context.
I can't see any way to pass acontext.Context
toNext()
nor when instantiating theMessagesContext
.I see that
MessagesContext
can be instantiated with thePullExpiry
opt, but I don't think this actually solves my problem.I'm using this over
Fetch
because of what it says in the docs, though it's worth noting theFetch()
API does not supportcontext.Context
either:Warning: Both Fetch() and FetchNoWait() have worse performance when used to continuously retrieve messages in comparison to Messages() or Consume() methods, as they do not perform any optimizations (pre-buffering) and new subscription is created for each execution.
Use case
As above.
Contribution
No response
The text was updated successfully, but these errors were encountered: