xBis7 commented on code in PR #68082:
URL: https://github.com/apache/airflow/pull/68082#discussion_r3567064800


##########
providers/apache/kafka/src/airflow/providers/apache/kafka/hooks/base.py:
##########
@@ -85,10 +109,38 @@ def get_ui_field_behaviour(cls) -> dict[str, Any]:
     def _get_client(self, config) -> Any:
         return AdminClient(config)
 
+    def _get_config(self) -> dict[str, Any]:
+        """Resolve the client config: the connection extras, with 
``config_dict`` keys taking precedence."""
+        config_dict = self.config_dict or {}
+        try:
+            config = 
dict(self.get_connection(self.kafka_config_id).extra_dejson)
+        except Exception:
+            # The connection lookup can fail for different reasons depending 
on the
+            # component the hook runs in (missing connection, no DB/API 
access). When
+            # ``config_dict`` carries the brokers the hook can run without a 
connection;
+            # otherwise re-raise.
+            if not config_dict.get("bootstrap.servers"):
+                raise
+            self.log.debug(
+                "Kafka connection %r is not available; building the client 
from 'config_dict' only.",
+                self.kafka_config_id,
+            )
+            config = {}
+        config.update(config_dict)
+        self._resolve_callbacks(config)

Review Comment:
   The patch was resolving the callbacks from both the connection and the 
`config_dict` param. I just removed the `config_dict` so now it just resolves 
them from the connection. Diffs are smaller and cleaner.



-- 
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