File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -91,28 +91,20 @@ async with asyncio.TaskGroup() as task_group:
91
91
task_group.create_task(
92
92
event.with_auto_ack(
93
93
handle_message(body),
94
- on_suppressed_exception = lambda _exception , event : logger .exception(
95
- " Failed to process message" , event = event
94
+ on_suppressed_exception = lambda _exception , event : log .exception(
95
+ " Failed to process message" , stompman_event = event
96
96
),
97
97
)
98
98
)
99
- case stompman.ErrorEvent(message_header = short_description, body = body):
100
- logger.error(
101
- " Received an error from server" , short_description = short_description, body = body, event = event
102
- )
99
+ case stompman.ErrorEvent():
100
+ log.error(" Received an error from server" , stompman_event = event)
103
101
case stompman.HeartbeatEvent():
104
102
task_group.create_task(update_healthcheck_status())
105
103
106
104
107
105
async def handle_message (event : stompman.MessageEvent) -> None :
108
- try :
109
- validated_message = MyMessageModel.model_validate_json(event.body)
110
- await run_business_logic(validated_message)
111
- except Exception :
112
- await event.nack()
113
- logger.exception(" Failed to handle message" , event = event)
114
- else :
115
- await event.ack()
106
+ validated_message = MyMessageModel.model_validate_json(event.body)
107
+ await run_business_logic(validated_message)
116
108
```
117
109
118
110
### Cleaning Up
You can’t perform that action at this time.
0 commit comments