ons_consumer_status.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package ons
  2. //Licensed under the Apache License, Version 2.0 (the "License");
  3. //you may not use this file except in compliance with the License.
  4. //You may obtain a copy of the License at
  5. //
  6. //http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. //Unless required by applicable law or agreed to in writing, software
  9. //distributed under the License is distributed on an "AS IS" BASIS,
  10. //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. //See the License for the specific language governing permissions and
  12. //limitations under the License.
  13. //
  14. // Code generated by Alibaba Cloud SDK Code Generator.
  15. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
  16. import (
  17. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
  18. "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
  19. )
  20. func (client *Client) OnsConsumerStatus(request *OnsConsumerStatusRequest) (response *OnsConsumerStatusResponse, err error) {
  21. response = CreateOnsConsumerStatusResponse()
  22. err = client.DoAction(request, response)
  23. return
  24. }
  25. func (client *Client) OnsConsumerStatusWithChan(request *OnsConsumerStatusRequest) (<-chan *OnsConsumerStatusResponse, <-chan error) {
  26. responseChan := make(chan *OnsConsumerStatusResponse, 1)
  27. errChan := make(chan error, 1)
  28. err := client.AddAsyncTask(func() {
  29. defer close(responseChan)
  30. defer close(errChan)
  31. response, err := client.OnsConsumerStatus(request)
  32. responseChan <- response
  33. errChan <- err
  34. })
  35. if err != nil {
  36. errChan <- err
  37. close(responseChan)
  38. close(errChan)
  39. }
  40. return responseChan, errChan
  41. }
  42. func (client *Client) OnsConsumerStatusWithCallback(request *OnsConsumerStatusRequest, callback func(response *OnsConsumerStatusResponse, err error)) <-chan int {
  43. result := make(chan int, 1)
  44. err := client.AddAsyncTask(func() {
  45. var response *OnsConsumerStatusResponse
  46. var err error
  47. defer close(result)
  48. response, err = client.OnsConsumerStatus(request)
  49. callback(response, err)
  50. result <- 1
  51. })
  52. if err != nil {
  53. defer close(result)
  54. callback(nil, err)
  55. result <- 0
  56. }
  57. return result
  58. }
  59. type OnsConsumerStatusRequest struct {
  60. *requests.RpcRequest
  61. Detail string `position:"Query" name:"Detail"`
  62. OnsRegionId string `position:"Query" name:"OnsRegionId"`
  63. ConsumerId string `position:"Query" name:"ConsumerId"`
  64. PreventCache string `position:"Query" name:"PreventCache"`
  65. NeedJstack string `position:"Query" name:"NeedJstack"`
  66. OnsPlatform string `position:"Query" name:"OnsPlatform"`
  67. }
  68. type OnsConsumerStatusResponse struct {
  69. *responses.BaseResponse
  70. RequestId string `json:"RequestId" xml:"RequestId"`
  71. HelpUrl string `json:"HelpUrl" xml:"HelpUrl"`
  72. Data struct {
  73. Online bool `json:"Online" xml:"Online"`
  74. TotalDiff int64 `json:"TotalDiff" xml:"TotalDiff"`
  75. ConsumeTps float64 `json:"ConsumeTps" xml:"ConsumeTps"`
  76. LastTimestamp int64 `json:"LastTimestamp" xml:"LastTimestamp"`
  77. DelayTime int64 `json:"DelayTime" xml:"DelayTime"`
  78. ConsumeModel string `json:"ConsumeModel" xml:"ConsumeModel"`
  79. SubscriptionSame bool `json:"SubscriptionSame" xml:"SubscriptionSame"`
  80. RebalanceOK bool `json:"RebalanceOK" xml:"RebalanceOK"`
  81. ConnectionSet []struct {
  82. ClientId string `json:"ClientId" xml:"ClientId"`
  83. ClientAddr string `json:"ClientAddr" xml:"ClientAddr"`
  84. Language string `json:"Language" xml:"Language"`
  85. Version string `json:"Version" xml:"Version"`
  86. } `json:"ConnectionSet" xml:"ConnectionSet"`
  87. DetailInTopicList []struct {
  88. Topic string `json:"Topic" xml:"Topic"`
  89. TotalDiff int64 `json:"TotalDiff" xml:"TotalDiff"`
  90. LastTimestamp int64 `json:"LastTimestamp" xml:"LastTimestamp"`
  91. DelayTime int64 `json:"DelayTime" xml:"DelayTime"`
  92. } `json:"DetailInTopicList" xml:"DetailInTopicList"`
  93. ConsumerConnectionInfoList []struct {
  94. ClientId string `json:"ClientId" xml:"ClientId"`
  95. Connection string `json:"Connection" xml:"Connection"`
  96. Language string `json:"Language" xml:"Language"`
  97. Version string `json:"Version" xml:"Version"`
  98. ConsumeModel string `json:"ConsumeModel" xml:"ConsumeModel"`
  99. ConsumeType string `json:"ConsumeType" xml:"ConsumeType"`
  100. ThreadCount int `json:"ThreadCount" xml:"ThreadCount"`
  101. StartTimeStamp int64 `json:"StartTimeStamp" xml:"StartTimeStamp"`
  102. LastTimeStamp int64 `json:"LastTimeStamp" xml:"LastTimeStamp"`
  103. SubscriptionSet []struct {
  104. Topic string `json:"Topic" xml:"Topic"`
  105. SubString string `json:"SubString" xml:"SubString"`
  106. SubVersion int64 `json:"SubVersion" xml:"SubVersion"`
  107. TagsSet []string `json:"TagsSet" xml:"TagsSet"`
  108. } `json:"SubscriptionSet" xml:"SubscriptionSet"`
  109. RunningDataList []struct {
  110. ConsumerId string `json:"ConsumerId" xml:"ConsumerId"`
  111. Topic string `json:"Topic" xml:"Topic"`
  112. Rt float64 `json:"Rt" xml:"Rt"`
  113. OkTps float64 `json:"OkTps" xml:"OkTps"`
  114. FailedTps float64 `json:"FailedTps" xml:"FailedTps"`
  115. FailedCountPerHour int64 `json:"FailedCountPerHour" xml:"FailedCountPerHour"`
  116. } `json:"RunningDataList" xml:"RunningDataList"`
  117. Jstack []struct {
  118. Thread string `json:"Thread" xml:"Thread"`
  119. TrackList []string `json:"TrackList" xml:"TrackList"`
  120. } `json:"Jstack" xml:"Jstack"`
  121. } `json:"ConsumerConnectionInfoList" xml:"ConsumerConnectionInfoList"`
  122. } `json:"Data" xml:"Data"`
  123. }
  124. func CreateOnsConsumerStatusRequest() (request *OnsConsumerStatusRequest) {
  125. request = &OnsConsumerStatusRequest{
  126. RpcRequest: &requests.RpcRequest{},
  127. }
  128. request.InitWithApiInfo("Ons", "2017-09-18", "OnsConsumerStatus", "", "")
  129. return
  130. }
  131. func CreateOnsConsumerStatusResponse() (response *OnsConsumerStatusResponse) {
  132. response = &OnsConsumerStatusResponse{
  133. BaseResponse: &responses.BaseResponse{},
  134. }
  135. return
  136. }