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

Mismatch datatype of consumer_tag in Basic.ConsumeOk #10

Open
duynhaaa opened this issue Mar 21, 2022 · 0 comments
Open

Mismatch datatype of consumer_tag in Basic.ConsumeOk #10

duynhaaa opened this issue Mar 21, 2022 · 0 comments

Comments

@duynhaaa
Copy link

duynhaaa commented Mar 21, 2022

This is how Pika generate consumer tag (line 336 in pika/channel.py):

def _generate_consumer_tag(self):
    """Generate a consumer tag

    NOTE: this protected method may be called by derived classes

    :returns: consumer tag
    :rtype: str

    """
    return 'ctag%i.%s' % (self.channel_number, uuid.uuid4().hex)

By default, the consumer tag is a str, which contradicts the data type of ConsumeOk.consume_tag in the stub file (line 1415 in pika-stubs/spec.pyi):

class ConsumeOk(amqp_object.Method):
    ...
    consumer_tag: Optional[int] = ...
    ...

So, is this an error on pika-stubs?

Disclaimer: I haven't read the AMQP specification. (Edit: I'm reading it, but not thoroughly)

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

No branches or pull requests

1 participant