You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by xy...@apache.org on 2023/02/16 15:22:16 UTC

[pulsar-client-python] 03/04: Add Human-readable description of MessageId object (#93)

This is an automated email from the ASF dual-hosted git repository.

xyz pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/pulsar-client-python.git

commit dcfd13657017ff825c7834d66c635a9967f378f9
Author: Eric Hare <er...@gmail.com>
AuthorDate: Tue Feb 14 19:45:29 2023 -0700

    Add Human-readable description of MessageId object (#93)
    
    (cherry picked from commit ed6983b6f0575e9807c5386891edf20de914a662)
---
 src/message.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/message.cc b/src/message.cc
index 1924bc2..6e8dd3f 100644
--- a/src/message.cc
+++ b/src/message.cc
@@ -55,6 +55,12 @@ void export_message(py::module_& m) {
                  oss << msgId;
                  return oss.str();
              })
+        .def("__repr__",
+             [](const MessageId& msgId) {
+                 std::ostringstream oss;
+                 oss << msgId;
+                 return oss.str();
+             })
         .def("__eq__", &MessageId::operator==)
         .def("__ne__", &MessageId::operator!=)
         .def("__le__", &MessageId::operator<=)