atk-common 3.12.0__py3-none-any.whl → 3.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ from atk_common.enums.image_part_type_enum import ImagePartType
16
16
  from atk_common.enums.image_shelf_type_enum import ImageShelfType
17
17
  from atk_common.enums.log_level_enum import LogLevel
18
18
  from atk_common.enums.metering_direction_enum import MeteringDirection
19
+ from atk_common.enums.mq_retry_action_type_enum import MqRetryActionType
19
20
  from atk_common.enums.multimotor_status_type_enum import MultiMotorStatusType
20
21
  from atk_common.enums.piezo_vehicle_type_enum import PiezoVehicleType
21
22
  from atk_common.enums.process_status_type_enum import ProcessStatusType
@@ -46,6 +47,7 @@ __all__ = [
46
47
  'ImageShelfType',
47
48
  'LogLevel',
48
49
  'MeteringDirection',
50
+ 'MqRetryActionType',
49
51
  'MultiMotorStatusType',
50
52
  'PiezoVehicleType',
51
53
  'ProcessStatusType',
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+ class MqRetryActionType(Enum):
4
+ SEND_TO_DLQ = 1
5
+ SEND_TO_RETRY = 2
6
+ DISCARD = 3
@@ -15,6 +15,12 @@ def create_retry_handler(process_func, connection, exchange, routing_key, should
15
15
 
16
16
  def handler(body, message):
17
17
  try:
18
+ retry_policy = {
19
+ "max_retries": 5,
20
+ "interval_start": 0.2,
21
+ "interval_step": 0.5,
22
+ "interval_max": 5,
23
+ }
18
24
  process_response = process_func(body, message)
19
25
  if is_response_ok(process_response):
20
26
  message.ack()
@@ -29,11 +35,14 @@ def create_retry_handler(process_func, connection, exchange, routing_key, should
29
35
  exchange=exchange,
30
36
  routing_key=routing_key,
31
37
  retry=True,
38
+ retry_policy=retry_policy,
32
39
  declare=declare,
33
40
  content_type=message.content_type,
34
41
  content_encoding=message.content_encoding,
35
42
  headers=message.headers,
36
- timestamp=message.properties.get("timestamp")
43
+ timestamp=message.properties.get("timestamp"),
44
+ mandatory=True,
45
+ delivery_mode=2
37
46
  )
38
47
  message.ack()
39
48
  else:
@@ -43,8 +52,6 @@ def create_retry_handler(process_func, connection, exchange, routing_key, should
43
52
  if should_retry(process_response):
44
53
  logger.error("Sending to DLQ...")
45
54
  message.reject(requeue=False)
46
- # bo_logger.error("Requing...")
47
- # message.requeue()
48
55
  else:
49
56
  logger.error("Discarding message...")
50
57
  message.ack()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atk_common
3
- Version: 3.12.0
3
+ Version: 3.14.0
4
4
  Summary: ATK common methods
5
5
  Home-page: https://github.com/pypa/atk_common
6
6
  Author: Roger
@@ -23,7 +23,7 @@ atk_common/classes/env_handler.py,sha256=h3snKwHwDvfc2dt1vgHasqv8n_vnsI9J2MAr-XM
23
23
  atk_common/classes/error_handler.py,sha256=DgRzWx4Yu8PKX1bqj55aWhrkqb92ebDaEwtxgKhTLls,3270
24
24
  atk_common/classes/http_response_handler.py,sha256=qgtGyEwUe4lIiayS6syWanr2VE6GaKHddazNL_PxEFM,2327
25
25
  atk_common/classes/rabbitmq_consumer.py,sha256=jct1UnfP-PU3IeWW2S_9dQ7FxmY0_M8YwZadFMv52j8,2936
26
- atk_common/enums/__init__.py,sha256=hOSoKWIBUpRFaMN2tNJiel6iGI1MHj229OYnU1J8Jg0,2636
26
+ atk_common/enums/__init__.py,sha256=JjIQ_bHIGxfWtf9Mlj36Gumll4otgLj0cR_oXF46XyY,2736
27
27
  atk_common/enums/api_error_type_enum.py,sha256=9oW6ZaZ3lhMwR8r2sVNWGliS9C_jV-otiOYdezAuTp0,91
28
28
  atk_common/enums/camera_cabinet_type_enum.py,sha256=U2NVrsTCBgaMRwYJamnjshAW8Y7xlOVjvUzakdgVH9A,90
29
29
  atk_common/enums/camera_role_enum.py,sha256=E0TH6zXj5EA889D7UndGP7xsgg5W23SneqJCFkA6BII,82
@@ -48,6 +48,7 @@ atk_common/enums/image_shelf_type.py,sha256=m2-nWi83tWi-KYpTMphyt-yhK5iGNvHrJBNY
48
48
  atk_common/enums/image_shelf_type_enum.py,sha256=m2-nWi83tWi-KYpTMphyt-yhK5iGNvHrJBNYjodx1P4,84
49
49
  atk_common/enums/log_level_enum.py,sha256=FxLCM0WQefqmAIA-I8TZNFalDgcMv7c85HDeUZcUIHA,110
50
50
  atk_common/enums/metering_direction_enum.py,sha256=ramBPt0fK_NsToCqiYmtzDVNsLVGbeF39TmSpn_ghTY,107
51
+ atk_common/enums/mq_retry_action_type_enum.py,sha256=WQTuecfh2TqmjWgQgo-iYQXtXkwhhfRXpNAnKFOCbK0,119
51
52
  atk_common/enums/multimotor_status_type_enum.py,sha256=TaoqSb6OjU17VAmFun28o8XhU3fkAKg_TQ9Kq8Y0Ff4,88
52
53
  atk_common/enums/piezo_vehicle_type_enum.py,sha256=tlFk9dP7KkJVBna8SIJf6MH9zJD_szSUcDxFATJ6LZE,89
53
54
  atk_common/enums/process_status_enum.py,sha256=09kRE5Cy8Sc7e7wf5gSkIw0RnNzFAWxIrMvn-aElqt8,140
@@ -70,7 +71,7 @@ atk_common/interfaces/error_handler_interface.py,sha256=ErhQ69T3fCYUl6sS5GwiMgW-
70
71
  atk_common/interfaces/http_response_handler_interface.py,sha256=Cl_njN_klHz1u06FCJPata1dua1w4Cs-Qt9Rg7uaB1c,169
71
72
  atk_common/interfaces/logger_interface.py,sha256=jK1gwkB_XmvqsTENhfOsw2QBplay16yVzc_qDSkgFyk,423
72
73
  atk_common/utils/__init__.py,sha256=hU5xicoI6dXRDz0gQADIDo2YbiL2UptTehVBISReIDo,1857
73
- atk_common/utils/consumer_retry_handler.py,sha256=-qnqxA07XLn0KKOGJCuyixqwmWYzM3g8Ii-ei2At3bY,2559
74
+ atk_common/utils/consumer_retry_handler.py,sha256=aumO5iwVP90UI3aYpMQeQXuDElSZfSmI5wxz6pbNnJY,2811
74
75
  atk_common/utils/datetime_utils.py,sha256=h3tv6iPD4peBXLCAcws41nuxIM4KpR1vk71LYXTDHKo,3662
75
76
  atk_common/utils/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
76
77
  atk_common/utils/default_should_retry.py,sha256=qghFbU71ygC8ARc0jkbDlxwZtwEPUqO8vGhIhGJX-Ao,838
@@ -81,7 +82,7 @@ atk_common/utils/http_utils.py,sha256=eSRuQeDgN0ISQdByZqE6cIGXoorcAXz7PEtVntHUKA
81
82
  atk_common/utils/internal_response_utils.py,sha256=2X9eLFEy1pO3Aesj1IRXg2yprwNcBDM5_dXaA5vfmMI,694
82
83
  atk_common/utils/mq_utils.py,sha256=DmVcXIZHG45p7cQVvgen6OT8QbW_UifFFJGJBybTkJQ,1835
83
84
  atk_common/utils/str_utils.py,sha256=sg3jwTTIfQvgGP-lcY5Xh4PXXhKWse_4HswBQYQKEo4,260
84
- atk_common-3.12.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
85
+ atk_common-3.14.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
85
86
  atk_package/__init__.py,sha256=okIFEefQhQrw6DZg6oCEVWsEdkVCk-57VXBW0IUG_wU,834
86
87
  atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
87
88
  atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
@@ -94,7 +95,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
94
95
  atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
95
96
  atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
96
97
  shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
97
- atk_common-3.12.0.dist-info/METADATA,sha256=1Shv97Ux1iGzXj0wPv3idbHG5Jg475j_NzawVu3O4lE,1761
98
- atk_common-3.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
99
- atk_common-3.12.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
100
- atk_common-3.12.0.dist-info/RECORD,,
98
+ atk_common-3.14.0.dist-info/METADATA,sha256=WfZAesNeogSA8knTLsKVIdeNBk9W0zrUETq_0nb8Uv0,1761
99
+ atk_common-3.14.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ atk_common-3.14.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
101
+ atk_common-3.14.0.dist-info/RECORD,,