Skip to content

Jetstream client does not use nats client's configured inbox prefix #777

@oliverlambson

Description

@oliverlambson

Observed behavior

pull_subscribe and pull_subscribe_bind do not use the client's inbox prefix, they use the default inbox prefix unless the call to the method explicitly re-passes the client's inbox prefix.

Expected behavior

Given the inbox prefix has already been configured in the client, I would expect that default to be used consistently, including for jetstream pull subscriptions.

Server and client version

server 2.12.1
client 2.12.0

Host environment

Mac, Docker

Steps to reproduce

from nats import NATS


async def main() -> None:
    nc = NATS()
    await nc.connect(inbox_prefix="_INBOX_demo")
    js = nc.jetstream()
    sub = await js.pull_subscribe("some.subject")  # does not use _INBOX_demo
    msg = await sub.fetch(1)

Suggested change

Instead of these defaults in the method signatures:

inbox_prefix: bytes = api.INBOX_PREFIX,

inbox_prefix: bytes = api.INBOX_PREFIX,

Use the same logic for _async_reply_prefix from earlier in the file:

self._async_reply_prefix = self._nc._inbox_prefix[:]

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSuspected defect such as a bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions