Skip to content

message

phachon edited this page Jun 6, 2018 · 5 revisions

Message Api

1.Add message

  • Path: /message/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 message comment
durable string true message is durable "1" true "0" false
is_need_token string true message is need check token when publish message "1" true "0" false
token string false publish token if is_need_token = "1", token is not empty
mode string true rabbitmq exchange type "topic", "direct", "fanout"
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {}
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

2.Update message

  • Path: /message/update?
  • 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 message comment
durable string true message is durable "1" true "0" false
is_need_token string true message is need check token when publish message "1" true "0" false
token string false publish token if is_need_token = "1", token is not empty
mode string true rabbitmq exchange type "topic", "direct", "fanout"
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {}
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

3.Delete message

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

4. Message consumers status

  • Path: /message/status?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
name string true message name
  • Success:
{
    "code": 1,
    "message": "success",
    "data": [
         {
            "name": "test",  // message name
            "consumer_id": "7f07144b-c9f4-452e-5c2c-23f78cf01b41", // consumer id
            "status": 0, // 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
        },
        {
            "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. Message list

  • Path: /message/list?

  • Request: HTTP

  • Method: GET

  • Auth Token: true -> How to pass token?

  • Params:

  • Success:

{
    "code": 1,
    "message": "success",
    "data": [
         {
             "consumers": [
                {
                "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": ""
	        }
	    ],
	    "durable": true,
	    "is_need_token": true,
	    "mode": "topic",
	    "name": "ada",
	    "token": "this is tokenssss",
	    "comment": "this is comment"
	},
	{
	    "consumers": [],
	    "durable": true,
	    "is_need_token": true,
	    "mode": "topic",
	    "name": "video",
	    "token": "videovideovideo",
	    "comment": "video"
	}
    ]
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": []
}

6. Get Message by name

  • Path: /message/getMessageByName?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
name string true message name
  • Success:
{
    "code": 1,
    "message": "success",
    "data": {
         "consumers": [
          {
            "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": ""
	  }
	],
	"durable": true,
	"is_need_token": true,
	"mode": "topic",
	"name": "ada",
	"token": "this is tokenssss",
	"comment": "this is comment"
    }
}
  • Failed:
{
    "code": 0,
    "message": "error",
    "data": {}
}

7. Get consumers by name

  • Path: /message/getConsumersByName?
  • Request: HTTP
  • Method: GET
  • Auth Token: true -> How to pass token?
  • Params:
name type required description comment
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": []
}

7. Reload message

Redeclare message and consumer to rabbitmq.

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