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

Add NatsBroker.new_inbox() #1543

Merged
merged 8 commits into from
Jun 21, 2024
Merged

Conversation

maxalbert
Copy link
Contributor

Fixes #1542

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • New feature (a non-breaking change that adds functionality)

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh

(Note: regarding the last item, running mypy produced 24 errors but they are all related to the confluent broker and not to my changes.)

Added missing 'and not confluent' to pytest command for running the
tests when no broker instances are present.
Lancetnik
Lancetnik previously approved these changes Jun 20, 2024
@Lancetnik Lancetnik added NATS Issues related to `faststream.nats` module and NATS broker features enhancement New feature or request labels Jun 20, 2024

[1] https://nats-io.github.io/nats.py/modules.html#nats.aio.client.Client.new_inbox
"""
return self._connection.new_inbox()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add assert here to check, that the broker is already connected (and ignore this asset by noseq)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint. I only saw this comment after I added a check which raises a RuntimeError. Please let me know if you'd like me to use a regular assert statement instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use assert in this case. I prefer to use switchable checks for development.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, done. Out of curiosity, what do you mean by using "switchable checks for development"?

Lancetnik
Lancetnik previously approved these changes Jun 21, 2024
@Lancetnik Lancetnik enabled auto-merge June 21, 2024 05:09
auto-merge was automatically disabled June 21, 2024 05:25

Head branch was pushed to by a user without write access

@maxalbert
Copy link
Contributor Author

FYI, I added one more line to the docstring (to mention NatsBroker's inbox_prefix argument) and merged the latest changes from main to bring the branch up to date.

@Lancetnik Lancetnik enabled auto-merge June 21, 2024 09:50
@Lancetnik Lancetnik added this pull request to the merge queue Jun 21, 2024
Merged via the queue into airtai:main with commit f8bb6bc Jun 21, 2024
28 of 29 checks passed
@maxalbert maxalbert deleted the feat/nats-new-inbox branch June 21, 2024 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request NATS Issues related to `faststream.nats` module and NATS broker features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: add support for new_inbox() in NatsBroker
2 participants