@@ -35,37 +35,15 @@ resource_exists(ReqData, Context) ->
35
35
end , ReqData , Context }.
36
36
37
37
to_json (ReqData , Context ) ->
38
+ % % This health check is deprecated and is now a no-op.
39
+ % % More specific health checks under GET /api/health/checks/* should be used instead.
40
+ % % https://www.rabbitmq.com/docs/monitoring#health-checks
38
41
rabbit_mgmt_util :with_channel (
39
42
rabbit_mgmt_util :vhost (ReqData ),
40
43
ReqData ,
41
44
Context ,
42
- fun (Ch ) ->
43
- # 'queue.declare_ok' {queue = ? QUEUE } = amqp_channel :call (Ch , # 'queue.declare' {
44
- queue = ? QUEUE
45
- }),
46
- ok = amqp_channel :call (Ch , # 'basic.publish' {routing_key = ? QUEUE }, # amqp_msg {
47
- payload = <<" test_message" >>
48
- }),
49
- case amqp_channel :call (Ch , # 'basic.get' {queue = ? QUEUE , no_ack = true }) of
50
- {# 'basic.get_ok' {}, _ } ->
51
- % % Don't delete the queue. If this is pinged every few
52
- % % seconds we don't want to create a mnesia transaction
53
- % % each time.
54
- rabbit_mgmt_util :reply ([{status , ok }], ReqData , Context );
55
- # 'basic.get_empty' {} ->
56
- Reason = <<" aliveness-test queue is empty" >>,
57
- failure (Reason , ReqData , Context );
58
- Error ->
59
- Reason = rabbit_data_coercion :to_binary (Error ),
60
- failure (Reason , ReqData , Context )
61
- end
62
- end
45
+ fun (_Ch ) -> rabbit_mgmt_util :reply ([{status , ok }], ReqData , Context ) end
63
46
).
64
47
65
- failure (Reason , ReqData0 , Context0 ) ->
66
- Body = #{status => failed , reason => Reason },
67
- {Response , ReqData1 , Context1 } = rabbit_mgmt_util :reply (Body , ReqData0 , Context0 ),
68
- {stop , cowboy_req :reply (? HEALTH_CHECK_FAILURE_STATUS , #{}, Response , ReqData1 ), Context1 }.
69
-
70
48
is_authorized (ReqData , Context ) ->
71
49
rabbit_mgmt_util :is_authorized_vhost (ReqData , Context ).
0 commit comments