jararaca 0.3.11a12__py3-none-any.whl → 0.3.11a13__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.
Potentially problematic release.
This version of jararaca might be problematic. Click here for more details.
- jararaca/cli.py +45 -41
- {jararaca-0.3.11a12.dist-info → jararaca-0.3.11a13.dist-info}/METADATA +1 -1
- {jararaca-0.3.11a12.dist-info → jararaca-0.3.11a13.dist-info}/RECORD +6 -6
- {jararaca-0.3.11a12.dist-info → jararaca-0.3.11a13.dist-info}/LICENSE +0 -0
- {jararaca-0.3.11a12.dist-info → jararaca-0.3.11a13.dist-info}/WHEEL +0 -0
- {jararaca-0.3.11a12.dist-info → jararaca-0.3.11a13.dist-info}/entry_points.txt +0 -0
jararaca/cli.py
CHANGED
|
@@ -78,6 +78,7 @@ async def declare_worker_infrastructure(
|
|
|
78
78
|
broker_url: str,
|
|
79
79
|
app: Microservice,
|
|
80
80
|
force: bool = False,
|
|
81
|
+
interactive_mode: bool = False,
|
|
81
82
|
) -> None:
|
|
82
83
|
"""
|
|
83
84
|
Declare the infrastructure (exchanges and queues) for worker.
|
|
@@ -100,25 +101,32 @@ async def declare_worker_infrastructure(
|
|
|
100
101
|
connection = await aio_pika.connect(broker_url)
|
|
101
102
|
channel = await connection.channel()
|
|
102
103
|
|
|
103
|
-
#
|
|
104
|
-
if force:
|
|
105
|
-
click.echo(f"→
|
|
104
|
+
# Only force delete infrastructure if requested at the beginning
|
|
105
|
+
if force or (interactive_mode and click.confirm(f"Delete existing infrastructure for exchange: {exchange}?")):
|
|
106
|
+
click.echo(f"→ Deleting existing infrastructure for exchange: {exchange}")
|
|
106
107
|
await RabbitmqUtils.delete_exchange(channel, exchange)
|
|
107
108
|
await RabbitmqUtils.delete_exchange(channel, RabbitmqUtils.DEAD_LETTER_EXCHANGE)
|
|
108
109
|
await RabbitmqUtils.delete_queue(channel, RabbitmqUtils.DEAD_LETTER_QUEUE)
|
|
109
110
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
try:
|
|
112
|
+
await RabbitmqUtils.declare_main_exchange(
|
|
113
|
+
channel=channel,
|
|
114
|
+
exchange_name=exchange,
|
|
115
|
+
passive=False,
|
|
116
|
+
)
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
dlx = await RabbitmqUtils.declare_dl_exchange(channel=channel, passive=False)
|
|
119
|
+
dlq = await RabbitmqUtils.declare_dl_queue(channel=channel, passive=False)
|
|
120
|
+
await dlq.bind(dlx, routing_key=RabbitmqUtils.DEAD_LETTER_EXCHANGE)
|
|
121
|
+
except Exception as e:
|
|
122
|
+
click.echo(f"Error during exchange declaration: {e}")
|
|
123
|
+
if force or (interactive_mode and click.confirm("Error occurred. Recreate infrastructure?")):
|
|
124
|
+
await channel.close()
|
|
125
|
+
await connection.close()
|
|
126
|
+
raise
|
|
127
|
+
click.echo("Skipping main exchange declaration due to error")
|
|
119
128
|
|
|
120
129
|
# Find all message handlers and scheduled actions
|
|
121
|
-
|
|
122
130
|
for instance_type in app.controllers:
|
|
123
131
|
controller_spec = MessageBusController.get_messagebus(instance_type)
|
|
124
132
|
if controller_spec is None:
|
|
@@ -127,50 +135,46 @@ async def declare_worker_infrastructure(
|
|
|
127
135
|
_, members = inspect_controller(instance_type)
|
|
128
136
|
|
|
129
137
|
# Declare queues for message handlers
|
|
130
|
-
for
|
|
131
|
-
|
|
138
|
+
for _, member in members.items():
|
|
132
139
|
message_handler = MessageHandler.get_message_incoming(
|
|
133
140
|
member.member_function
|
|
134
141
|
)
|
|
135
142
|
if message_handler is not None:
|
|
136
|
-
|
|
137
143
|
queue_name = f"{message_handler.message_type.MESSAGE_TOPIC}.{member.member_function.__module__}.{member.member_function.__qualname__}"
|
|
138
144
|
routing_key = f"{message_handler.message_type.MESSAGE_TOPIC}.#"
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
await RabbitmqUtils.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
f"
|
|
151
|
-
|
|
146
|
+
try:
|
|
147
|
+
# Try to declare queue
|
|
148
|
+
queue = await RabbitmqUtils.declare_worker_queue(
|
|
149
|
+
channel=channel, queue_name=queue_name, passive=False
|
|
150
|
+
)
|
|
151
|
+
await queue.bind(exchange=exchange, routing_key=routing_key)
|
|
152
|
+
click.echo(
|
|
153
|
+
f"✓ Declared message handler queue: {queue_name} (routing key: {routing_key})"
|
|
154
|
+
)
|
|
155
|
+
except Exception as e:
|
|
156
|
+
click.echo(f"⚠ Skipping message handler queue {queue_name} due to error: {e}")
|
|
157
|
+
continue
|
|
152
158
|
|
|
153
159
|
scheduled_action = ScheduledAction.get_scheduled_action(
|
|
154
160
|
member.member_function
|
|
155
161
|
)
|
|
156
162
|
if scheduled_action is not None:
|
|
157
|
-
|
|
158
|
-
# Declare queues for scheduled actions
|
|
159
|
-
|
|
160
163
|
queue_name = f"{member.member_function.__module__}.{member.member_function.__qualname__}"
|
|
161
164
|
routing_key = queue_name
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
await RabbitmqUtils.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
try:
|
|
167
|
+
# Try to declare queue
|
|
168
|
+
queue = await RabbitmqUtils.declare_scheduled_action_queue(
|
|
169
|
+
channel=channel, queue_name=queue_name, passive=False
|
|
170
|
+
)
|
|
171
|
+
await queue.bind(exchange=exchange, routing_key=routing_key)
|
|
172
|
+
click.echo(
|
|
173
|
+
f"✓ Declared scheduled action queue: {queue_name} (routing key: {routing_key})"
|
|
174
|
+
)
|
|
175
|
+
except Exception as e:
|
|
176
|
+
click.echo(f"⚠ Skipping scheduled action queue {queue_name} due to error: {e}")
|
|
177
|
+
continue
|
|
174
178
|
|
|
175
179
|
await channel.close()
|
|
176
180
|
await connection.close()
|
|
@@ -3,7 +3,7 @@ jararaca/__main__.py,sha256=-O3vsB5lHdqNFjUtoELDF81IYFtR-DSiiFMzRaiSsv4,67
|
|
|
3
3
|
jararaca/broker_backend/__init__.py,sha256=GzEIuHR1xzgCJD4FE3harNjoaYzxHMHoEL0_clUaC-k,3528
|
|
4
4
|
jararaca/broker_backend/mapper.py,sha256=vTsi7sWpNvlga1PWPFg0rCJ5joJ0cdzykkIc2Tuvenc,696
|
|
5
5
|
jararaca/broker_backend/redis_broker_backend.py,sha256=a7DHchy3NAiD71Ix8SwmQOUnniu7uup-Woa4ON_4J7I,5786
|
|
6
|
-
jararaca/cli.py,sha256=
|
|
6
|
+
jararaca/cli.py,sha256=pmwWDk7muP_BsDgWTcyiCOIhSbEJuuEoNFSiH2g27b4,19753
|
|
7
7
|
jararaca/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
jararaca/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
jararaca/core/providers.py,sha256=wktH84FK7c1s2wNq-fudf1uMfi3CQBR0neU2czJ_L0U,434
|
|
@@ -66,8 +66,8 @@ jararaca/tools/app_config/interceptor.py,sha256=HV8h4AxqUc_ACs5do4BSVlyxlRXzx7Hq
|
|
|
66
66
|
jararaca/tools/typescript/interface_parser.py,sha256=35xbOrZDQDyTXdMrVZQ8nnFw79f28lJuLYNHAspIqi8,30492
|
|
67
67
|
jararaca/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
68
|
jararaca/utils/rabbitmq_utils.py,sha256=ytdAFUyv-OBkaVnxezuJaJoLrmN7giZgtKeet_IsMBs,10918
|
|
69
|
-
jararaca-0.3.
|
|
70
|
-
jararaca-0.3.
|
|
71
|
-
jararaca-0.3.
|
|
72
|
-
jararaca-0.3.
|
|
73
|
-
jararaca-0.3.
|
|
69
|
+
jararaca-0.3.11a13.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
70
|
+
jararaca-0.3.11a13.dist-info/METADATA,sha256=akkZ-YQwyNhyiFNRgvBCooSVevh2SlRmNH5I_tdeJCE,4998
|
|
71
|
+
jararaca-0.3.11a13.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
72
|
+
jararaca-0.3.11a13.dist-info/entry_points.txt,sha256=WIh3aIvz8LwUJZIDfs4EeH3VoFyCGEk7cWJurW38q0I,45
|
|
73
|
+
jararaca-0.3.11a13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|