merlimat commented on code in PR #265:
URL: 
https://github.com/apache/pulsar-client-python/pull/265#discussion_r2197049293


##########
src/config.cc:
##########
@@ -104,6 +105,19 @@ class HIDDEN LoggerWrapperFactory : public LoggerFactory, 
public CaptivePythonOb
     }
 };
 
+using MessageRouterFunc = std::function<int(const Message&, int)>;
+class HIDDEN MessageRouter : public pulsar::MessageRoutingPolicy {
+   public:
+    explicit MessageRouter(MessageRouterFunc func) : func_(std::move(func)) {}
+
+    int getPartition(const Message& msg, const TopicMetadata& topicMetadata) 
final {
+        return func_(msg, topicMetadata.getNumPartitions());

Review Comment:
   Should we reacquire the GIL before calling the py code?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to