@@ -1568,6 +1568,47 @@ rd_kafka_conf_t *common_conf_setup (rd_kafka_type_t ktype,
1568
1568
/* Enable valid offsets in delivery reports */
1569
1569
rd_kafka_topic_conf_set (tconf , "produce.offset.report" , "true" , NULL , 0 );
1570
1570
1571
+ /*
1572
+ * Plugins must be configured prior to handling any of their configuration properties.
1573
+ * Dicts are unordered so we explicitly check for, set, and delete the plugin paths here.
1574
+ * This ensures all configuration properties are handled in the right order.
1575
+ */
1576
+ if ((vo = PyDict_GetItemString (confdict , "plugin.library.paths" ))) {
1577
+ const char * v ;
1578
+ char errstr [256 ];
1579
+ PyObject * vs = NULL , * vs8 = NULL ;
1580
+
1581
+ if (!(vs = cfl_PyObject_Unistr (vo ))) {
1582
+ PyErr_SetString (PyExc_TypeError ,
1583
+ "expected configuration property name "
1584
+ "as type unicode string" );
1585
+ rd_kafka_topic_conf_destroy (tconf );
1586
+ rd_kafka_conf_destroy (conf );
1587
+ return NULL ;
1588
+ }
1589
+
1590
+ v = cfl_PyUnistr_AsUTF8 (vs , & vs8 );
1591
+
1592
+ if (rd_kafka_conf_set (conf , "plugin.library.paths" , v , errstr , sizeof (errstr ))
1593
+ != RD_KAFKA_CONF_OK ) {
1594
+ cfl_PyErr_Format (RD_KAFKA_RESP_ERR__INVALID_ARG ,
1595
+ "%s" , NULL );
1596
+
1597
+ rd_kafka_topic_conf_destroy (tconf );
1598
+ rd_kafka_conf_destroy (conf );
1599
+
1600
+ Py_XDECREF (vs8 );
1601
+ Py_XDECREF (vs );
1602
+
1603
+ return NULL ;
1604
+ }
1605
+
1606
+ Py_XDECREF (vs8 );
1607
+ Py_DECREF (vs );
1608
+
1609
+ PyDict_DelItemString (confdict , "plugin.library.paths" );
1610
+ }
1611
+
1571
1612
/* Convert config dict to config key-value pairs. */
1572
1613
while (PyDict_Next (confdict , & pos , & ko , & vo )) {
1573
1614
PyObject * ks , * ks8 ;
0 commit comments