You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by di...@apache.org on 2019/10/23 11:36:57 UTC

[rocketmq-client-python] branch master updated: feat(producer) add specified order producer

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

dinglei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-python.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f74f8f  feat(producer) add specified order producer
     new 6d7a08b  Merge pull request #60 from duhenglucky/order_producer
0f74f8f is described below

commit 0f74f8fbc2c0c7aa01c1e1e60d0ddd1fd872e04a
Author: duhenglucky <du...@gmail.com>
AuthorDate: Wed Oct 23 19:16:33 2019 +0800

    feat(producer) add specified order producer
---
 src/PythonWrapper.cpp | 6 ++++++
 src/PythonWrapper.h   | 1 +
 2 files changed, 7 insertions(+)

diff --git a/src/PythonWrapper.cpp b/src/PythonWrapper.cpp
index 2783015..5fb1d53 100644
--- a/src/PythonWrapper.cpp
+++ b/src/PythonWrapper.cpp
@@ -124,6 +124,11 @@ void *PyCreateProducer(const char *groupId) {
     return (void *) CreateProducer(groupId);
 }
 
+void *PyCreateOrderProducer(const char *groupId) {
+    PyEval_InitThreads();  // ensure create GIL, for call Python callback from C.
+    return (void *) CreateOrderlyProducer(groupId);
+}
+
 void *PyCreateTransactionProducer(const char *groupId, PyObject *localTransactionCheckerCallback) {
     PyEval_InitThreads();
     CProducer *producer = CreateTransactionProducer(groupId, &PyLocalTransactionCheckerCallback, NULL);
@@ -474,6 +479,7 @@ BOOST_PYTHON_MODULE (librocketmqclientpython) {
 
     //For producer
     def("CreateProducer", PyCreateProducer, return_value_policy<return_opaque_pointer>());
+    def("CreateOrderProducer", PyCreateOrderProducer, return_value_policy<return_opaque_pointer>());
     def("CreateTransactionProducer", PyCreateTransactionProducer, return_value_policy<return_opaque_pointer>());
     def("DestroyProducer", PyDestroyProducer);
     def("DestroyTransactionProducer", PyDestroyTransactionProducer);
diff --git a/src/PythonWrapper.h b/src/PythonWrapper.h
index 732320b..8fdb04f 100644
--- a/src/PythonWrapper.h
+++ b/src/PythonWrapper.h
@@ -100,6 +100,7 @@ const char *PyGetMessageId(PyMessageExt msgExt);
 
 //producer
 void *PyCreateProducer(const char *groupId);
+void *PyCreateOrderProducer(const char *groupId);
 CTransactionStatus PyLocalTransactionCheckerCallback(CProducer *producer, CMessageExt *msg, void *data);
 CTransactionStatus PyLocalTransactionExecuteCallback(CProducer *producer, CMessage *msg, void *data);
 void *PyCreateTransactionProducer(const char *groupId, PyObject *localTransactionCheckerCallback);