Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 65a07f7

Browse files
committed
[client] Ack in enrichment
1 parent 2d33e3c commit 65a07f7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ def _process_message(self, channel, method, properties, body) -> None:
220220
:type body: str or bytes or bytearray
221221
"""
222222
json_data = json.loads(body)
223+
# Message should be ack before processing as we don't own the processing
224+
# Not ACK the message here may lead to infinite re-deliver if the connector is broken
225+
# Also ACK, will not have any impact on the blocking aspect of the following functions
226+
channel.basic_ack(delivery_tag=method.delivery_tag)
223227
self.thread = threading.Thread(target=self._data_handler, args=[json_data])
224228
self.thread.start()
225229
five_minutes = 60 * 5
@@ -234,7 +238,6 @@ def _process_message(self, channel, method, properties, body) -> None:
234238
else:
235239
time_wait += 1
236240
time.sleep(1)
237-
channel.basic_ack(delivery_tag=method.delivery_tag)
238241
LOGGER.info(
239242
"Message (delivery_tag=%s) processed, thread terminated",
240243
method.delivery_tag,

0 commit comments

Comments
 (0)