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

Added support to export subjects when fetching js.stream_info() #521

Closed
wants to merge 1 commit into from

Conversation

bsmith1180
Copy link

I added support for the python client to query subjects held in a stream.

The PR adds a field subjects to the js StreamState class (js/api.py)
and populates it through the JetStreamManager.stream_info() method. It also adds a subject_filter keyword parameter to stream_info()

@@ -68,12 +68,13 @@ async def find_stream_name_by_subject(self, subject: str) -> str:
raise NotFoundError
return info['streams'][0]

async def stream_info(self, name: str) -> api.StreamInfo:
async def stream_info(self, name: str, subjects_filter: str = '>') -> api.StreamInfo:
Copy link
Member

Choose a reason for hiding this comment

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

I think we want subjects_filter to be an optional parameter by default so something like:

Suggested change
async def stream_info(self, name: str, subjects_filter: str = '>') -> api.StreamInfo:
async def stream_info(self, name: str, subjects_filter: str = None) -> api.StreamInfo:

resp = await self._api_request(
f"{self._prefix}.STREAM.INFO.{name}", timeout=self._timeout
f"{self._prefix}.STREAM.INFO.{name}", req_data.encode(), timeout=self._timeout
Copy link
Member

Choose a reason for hiding this comment

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

would prefer to send the subjects_filter JSON only when explicitly specifying a subject.

@wallyqs
Copy link
Member

wallyqs commented Dec 22, 2023

Thanks for the PR, I left a couple of comments in case you want to address, I will include this fix in the next release.

@wallyqs
Copy link
Member

wallyqs commented Feb 20, 2024

Commit included as part of this set of changes: #527

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

Successfully merging this pull request may close these issues.

None yet

2 participants