Commit Graph

10 Commits

Author SHA1 Message Date
Zaiming (Stone) Shi 46877e979b chore: update copyright-year 2024-02-23 08:21:06 +01:00
Stefan Strigler f8e9e54393 refactor: move emqx_json to emqx_utils_json 2023-04-14 13:31:27 +02:00
Zaiming (Stone) Shi dbc10c2eed chore: update copyright year 2023 2023-01-02 09:22:27 +01:00
Erik Timan 0242d5f360 test: rename return_body to return_all in emqx_mgmt api test util 2022-12-12 13:29:11 +01:00
Stefan Strigler afcb33aa20 feat: support publish with properties 2022-11-23 17:04:35 +01:00
Stefan Strigler acef85e11a test: initialize clients in test setup, teardown after test 2022-11-23 17:03:43 +01:00
Zaiming (Stone) Shi d1332b72e7 feat(api/publish): return detailed publish results
Prior to this change, the publish API returns 200 in most of
the cases.
This change provides more insights to the publish result.

For single message publish endpoint (`publish/`):

HTTP error codes are:

200: Everything is OK
202: No subscriber for the topic
400: When mesage is invalid message.
     e.g. bad topic name or QoS out of range.
503: Failed to dispatch the message. e.g. during EMQX restart.

The response body is a JSON object with two fields
`message_id`, and `publish_result`.
The `message_id` is a globally unique ID for tracing.
`publish_result` is `"OK"` when the message is delivered
to at least one subscriber.
Otherwise `"no_subscriber"`.
`publish_result` may also be some other informative
message to hint the failure result, the content of which
may change in the future.

For `publish/bulk` endpoint:

200: When all message in the bulk are published OK
202: If at least one message in the bulk had `"no_subscriber"` result
400: When mesage is invalid message. e.g. bad topic name or
     QoS out of range.
503: When there is at least one message failed at dispatch.

The reply body is a list of JSON objects having the same layout
as for hte `publish` endpoint.
2022-10-20 20:03:27 +02:00
Ivan Dyachkov 5a8cab46a9 test: update publish api test suite 2022-10-14 10:17:22 +02:00
Zhongwen Deng aa7807baeb chore: reformat mgmt code. 2022-04-19 14:02:39 +08:00
zhongwencool 81abf31bc4 chore(test): rename mgmt_xxx_api_SUITE to mgmt_api_xxx_SUITE 2022-01-10 15:52:00 +08:00