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

Updated manager.py documentation to include missing delete function. C… #634

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions nats/js/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ async def update_stream(
async def delete_stream(self, name: str) -> bool:
"""
Delete a stream by name.

:param stream: The name of the stream from which the consumer should be deleted.
"""
resp = await self._api_request(
f"{self._prefix}.STREAM.DELETE.{name}", timeout=self._timeout
Expand Down Expand Up @@ -263,6 +265,12 @@ async def add_consumer(
return api.ConsumerInfo.from_response(resp)

async def delete_consumer(self, stream: str, consumer: str) -> bool:
"""
Delete a consumer from a given stream.

:param stream: The name of the stream from which the consumer should be deleted.
:param consumer: The name of the consumer to be deleted.
"""
resp = await self._api_request(
f"{self._prefix}.CONSUMER.DELETE.{stream}.{consumer}",
b"",
Expand All @@ -278,6 +286,7 @@ async def consumers_info(
"""
consumers_info retrieves a list of consumers. Consumers list limit is 256 for more
consider to use offset

:param stream: stream to get consumers
:param offset: consumers list offset
"""
Expand Down Expand Up @@ -386,6 +395,9 @@ def _lift_msg_to_raw_msg(self, msg) -> api.RawStreamMsg:
async def delete_msg(self, stream_name: str, seq: int) -> bool:
"""
delete_msg retrieves a message from a stream based on the sequence ID.

:param stream_name: The name of the stream from which the message should be deleted.
:param seq: The sequence id to delete
"""
req_subject = f"{self._prefix}.STREAM.MSG.DELETE.{stream_name}"
req = {"seq": seq}
Expand Down
Loading