Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendAsync #352

Open
pmcvay opened this issue Sep 7, 2021 · 3 comments
Open

SendAsync #352

pmcvay opened this issue Sep 7, 2021 · 3 comments

Comments

@pmcvay
Copy link

pmcvay commented Sep 7, 2021

(I apologize for this question as I am a beginner to scala)

Is there an example anywhere on how to use sendAsync?

I am trying to do the following:
if sCol is a collection on strings
Then I would like to do
sCol.map(producer.sendAsync(_))
wait until all complete

@pmcvay
Copy link
Author

pmcvay commented Sep 7, 2021

Or does the default send use batching without waiting?

@pmcvay
Copy link
Author

pmcvay commented Sep 8, 2021

If I just do sCol.map(producer.send(_)), then it is terribly slow so I do not think the messages are being batched

@sksamuel
Copy link
Contributor

sksamuel commented Sep 8, 2021

Your last example will send one at a time.
You can sendAsync then collect all the futures using .sequence and then await on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants