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

Improve logic to avoid block call under non blocking thread #43063

Conversation

moarychan
Copy link
Member

@moarychan moarychan commented Nov 22, 2024

Description

Cherry-pick from #40772

Issues #12500, #35845 and #35215 appear to be due to EventHubsTemplate.doSend performing a block() call. When used by the non-async methods in EventHubsTemplate, or the async methods when a non-parallel Reactor Scheduler is being used, this will work well enough. But when using a parallel Reactor Scheduler, blocking calls are prohibited.

This PR restructures the code in EventHubsTemplate.doSend to not use a blocking call. A test was added first to verify that we could detect this condition by performing one of the existing test cases with Scheduler.parallel(). After the changes to EventHubsTemplate, this test passes.

And fix the same issue for DefaultMessageHandler.handleMessageInternal.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@github-actions github-actions bot added the azure-spring All azure-spring related issues label Nov 22, 2024
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

sdk/spring/CHANGELOG.md Outdated Show resolved Hide resolved
@moarychan moarychan merged commit 3c2cf70 into Azure:main Nov 22, 2024
25 checks passed
@saragluna saragluna added this to the 2024-12 milestone Nov 25, 2024
@moarychan moarychan deleted the bugfixes/improve-logic--to-avoid-block-call-under-non-blocking-thread branch November 26, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants