potiuk commented on code in PR #41601:
URL: https://github.com/apache/airflow/pull/41601#discussion_r1744565440


##########
airflow/providers/microsoft/azure/hooks/asb.py:
##########
@@ -326,5 +342,32 @@ def receive_subscription_message(
                 max_message_count=max_message_count, 
max_wait_time=max_wait_time
             )
             for msg in received_msgs:
-                self.log.info(msg)
-                subscription_receiver.complete_message(msg)
+                self._process_message(msg, message_callback, 
subscription_receiver)
+
+    def _process_message(
+        self,
+        msg: ServiceBusReceivedMessage,
+        message_callback: MessageCallback | None,
+        receiver: ServiceBusReceiver,
+    ):
+        """
+        Process the message by calling the message_callback or logging the 
message.
+
+        :param msg: The message to process.
+        :param message_callback: Optional callback to process each message. If 
not provided, then
+            the message will be logged and completed. If provided, and throws 
an exception, the
+            message will be abandoned for future redelivery.
+        :param receiver: The receiver that received the message.
+        """
+        if message_callback is None:
+            self.log.info(msg)

Review Comment:
   Is this right thing to print info for each callback? That looks pretty 
eccessive.



##########
airflow/providers/microsoft/azure/hooks/asb.py:
##########
@@ -326,5 +342,32 @@ def receive_subscription_message(
                 max_message_count=max_message_count, 
max_wait_time=max_wait_time
             )
             for msg in received_msgs:
-                self.log.info(msg)
-                subscription_receiver.complete_message(msg)
+                self._process_message(msg, message_callback, 
subscription_receiver)
+
+    def _process_message(
+        self,
+        msg: ServiceBusReceivedMessage,
+        message_callback: MessageCallback | None,
+        receiver: ServiceBusReceiver,
+    ):
+        """
+        Process the message by calling the message_callback or logging the 
message.
+
+        :param msg: The message to process.
+        :param message_callback: Optional callback to process each message. If 
not provided, then
+            the message will be logged and completed. If provided, and throws 
an exception, the
+            message will be abandoned for future redelivery.
+        :param receiver: The receiver that received the message.
+        """
+        if message_callback is None:
+            self.log.info(msg)

Review Comment:
   Is this right thing to print info for each callback? That looks pretty 
excessive.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to