Skip to content

Python Client Producer Synchronous Send Void Return Value #9176

Closed

Description

@alexanderursu99

Is your enhancement request related to a problem? Please describe.
A clear and concise description of what the enhancement is.

It seems as though the Python client producer has void return values for all of its functions. The relevant file is here. Because of how the Python package is a wrapper of the C++ one, I'm not sure if this is doable, but it would make sense for at least the send method to return something. For example, the synchronous send method should preferably return the MessageID of the message sent. If a producer client wants to know the MessageID of the delivered message in a synchronous manner, the only way it seems possible now is to use send_async and register a callback function, and then flush to ensure it waits until all messages in the queue are acknowledged.

Describe the solution you'd like
A clear and concise description of what you want to happen.

For the Python client producer send method to have a useful return value.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Currently building an app where we'd like to know the MessageID of the message just recently sent to a topic, and use that MessageID as the value of a field in other topics.

Activity

  1. added
    type/enhancement
    on Jan 11, 2021
  2. changed the title [-]Python Client Synchronous Send Void Return Value[/-] [+]Python Client Producer Synchronous Send Void Return Value[/+] on Jan 11, 2021
  3. BewareMyPower commented on Jan 12, 2021

    @BewareMyPower
    Contributor

    Yes, it's also a problem of C++ client that synchronous send can't retrieve the message id. It's an issue of the initial API design.

    The fix may change the API, I'm not sure if it's proper. A simple fix that keeps the compatibility may be adding a overload method to Producer::send:

        Result send(const Message& msg);  // the original API
    
        Result send(const Message& msg, MessageId& msgId);  // the new API
  4. BewareMyPower commented on Jan 22, 2021

    @BewareMyPower
    Contributor

    I just found that the current C++ send API design is strange that though msg is const, the MessageId will be stored in msg and user can get message id by msg.getMessageId() after send returns. But the document didn't explain it.

    Anyway, Python client doesn't expose the Message so user cannot get message id.

    I'll add the new API of Producer::send to let Python client get the message id and improve the docs.

  5. added a commit that references this issue on Jan 25, 2021
    0e6bbc8
  6. added a commit that references this issue on Feb 19, 2021
    0f84630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions