Skip to content

consumer

phachon edited this page Jun 6, 2018 · 3 revisions

Consumer Api

1.Add consumer

  • Path: /consumer/add?
  • Request: HTTP
  • Method: POST
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
name string true message name
comment string true this consumer comment
url string true consumer url not empty
route_key string false rabbitmq consumer route_key
check_code string true When the request consumer the url, whether to check the url's return status code "1" true "0" false
code string true If you need to check code, please input the code If code check error, the publish message consumer failed
timeout string true request the consumer url timeout
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {}
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

2.Update consumer

  • Path: /consumer/update?
  • Request: HTTP
  • Method: POST
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
consumer_id string true consumer id
name string true message name
comment string true this consumer comment
url string true consumer url not empty
route_key string false rabbitmq consumer route_key
check_code string true When the request consumer the url, whether to check the url's return status code "1" true "0" false
code string true If you need to check code, please input the code If code check error, the publish message consumer failed
timeout string true request the consumer url timeout
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {}
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

3.Delete consumer

  • Path: /consumer/delete?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
consumer_id string true consumer id
name string true message name
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {}
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

4. Consumer status

  • Path: /consumer/status?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
consumer_id string true consumer id
name string true message name
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {
        "name": "test",  // message name
        "consumer_id": "7f07144b-c9f4-452e-5c2c-23f78cf01b42", // consumer id
        "status": 1, // 0 this consumer run stop;1 this consumer run normally
        "last_time": "1514363567", // this consumer run last time
        "count": "200", // count of messages rabbitmq not awaiting acknowledgment
    }
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": []
}

5. Get consumer by consumerId

  • Path: /consumer/getConsumerById?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
consumer_id string true consumer id
name string true message name
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {
        "id": "48b441f9-a54b-487c-4ec5-3d81d3282f2a",
        "url": "http://127.0.0.1:80/test222.php",
	"route_key": "test222",
	"timeout": 2000,
	"code": 200,
	"check_code": true,
	"comment": ""
    }
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}
Clone this wiki locally