Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-enterprise
Commits
9b5c3341
Commit
9b5c3341
authored
Feb 13, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息路由接口
parent
6a592c03
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
167 additions
and
0 deletions
+167
-0
MQController.java
...n/java/com/gic/operation/web/controller/MQController.java
+131
-0
RouterConsoleVO.java
...c/main/java/com/gic/operation/web/vo/RouterConsoleVO.java
+32
-0
dubbo-gic-platform-operation-web.xml
...b/src/main/resources/dubbo-gic-platform-operation-web.xml
+4
-0
No files found.
gic-platform-operation-web/src/main/java/com/gic/operation/web/controller/MQController.java
0 → 100644
View file @
9b5c3341
package
com
.
gic
.
operation
.
web
.
controller
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.mq.sdk.entity.*
;
import
com.gic.mq.sdk.entity.response.AddRouterResponse
;
import
com.gic.mq.sdk.entity.response.DeleteRouterResponse
;
import
com.gic.mq.sdk.entity.response.UpdateResponse
;
import
com.gic.mq.sdk.service.MQConfigService
;
import
com.gic.mq.sdk.service.MQStatusService
;
import
com.gic.operation.web.vo.RouterConsoleVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
*
* @Description:
* @author zhiwj
* @date 2020/2/13 10:34
*/
@RestController
public
class
MQController
{
@Autowired
private
MQConfigService
mqConfigService
;
@Autowired
private
MQStatusService
mqStatusService
;
@RequestMapping
(
"/routers-list"
)
public
RestResponse
queryRouteConfig
()
{
List
<
MQRouterEntity
>
currentRouters
=
mqConfigService
.
getCurrentRouters
();
return
RestResponse
.
success
(
currentRouters
);
}
@RequestMapping
(
"/add-router"
)
public
RestResponse
addRouter
(
MQRouter
mqRouter
)
{
AddRouterResponse
addRouterResponse
=
mqConfigService
.
addRouter
(
mqRouter
);
return
RestResponse
.
success
(
addRouterResponse
);
}
@RequestMapping
(
"/update-router"
)
public
RestResponse
updateRouter
(
MQRouter
mqRouter
)
{
UpdateResponse
updateResponse
=
mqConfigService
.
updateRouter
(
mqRouter
);
return
RestResponse
.
success
(
updateResponse
);
}
@RequestMapping
(
"/del-router"
)
public
RestResponse
delRouter
(
String
routerName
)
{
DeleteRouterResponse
deleteRouterResponse
=
mqConfigService
.
deleteRouter
(
routerName
);
return
RestResponse
.
success
(
deleteRouterResponse
);
}
/**
* 路由规则状态
* @return
*/
@RequestMapping
(
"/router-running-list"
)
public
RestResponse
routerRunningList
()
{
List
<
MQRouterRunningInfo
>
routerRunningInfo
=
mqStatusService
.
getRouterRunningInfo
();
return
RestResponse
.
success
(
routerRunningInfo
);
}
/**
* 消息队列状态
* @return
*/
@RequestMapping
(
"/channel-infos"
)
public
RestResponse
channelInfos
()
{
List
<
MQChannelInfo
>
channelInfos
=
mqStatusService
.
getChannelInfos
();
return
RestResponse
.
success
(
channelInfos
);
}
/**
* 阻塞队列状态
*/
@RequestMapping
(
"/bloking-key-list"
)
public
RestResponse
blokingKeyList
()
{
List
<
MQBlockingEntity
>
blokingKeyList
=
mqStatusService
.
getBlokingKeyList
();
return
RestResponse
.
success
(
blokingKeyList
);
}
/**
* 控制台
* @return
*/
@RequestMapping
(
"/router-console"
)
public
RestResponse
routerConsole
()
{
// 运行状态
MQStatusInfo
runningStatus
=
mqStatusService
.
getRunningStatus
();
// 配置信息
MQConfigInfo
mqConfig
=
mqConfigService
.
getMQConfig
();
/*
dispatchWorkerNum: 1
readWorkerNum: 3
checkWorkerNum: 1
readingMessageStopped: 0
*/
RouterConsoleVO
routerConsoleVO
=
new
RouterConsoleVO
();
routerConsoleVO
.
setMqConfigInfo
(
mqConfig
);
routerConsoleVO
.
setMqStatusInfo
(
runningStatus
);
return
RestResponse
.
success
(
routerConsoleVO
);
}
@RequestMapping
(
"/update-console"
)
public
RestResponse
updateConsole
(
Integer
dispatchWorkerNum
,
Integer
readWorkerNum
,
Integer
checkWorkerNum
,
Integer
readingMessageStopped
)
{
UpdateResponse
updateResponse0
=
mqConfigService
.
updateDispatchWorkerNum
(
dispatchWorkerNum
);
if
(!
updateResponse0
.
isSuccess
())
{
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
updateResponse0
.
getMessage
());
}
UpdateResponse
updateResponse1
=
mqConfigService
.
updateReadWorkerNum
(
readWorkerNum
);
if
(!
updateResponse1
.
isSuccess
())
{
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
updateResponse1
.
getMessage
());
}
UpdateResponse
updateResponse2
=
mqConfigService
.
updateCheckWorkerNum
(
checkWorkerNum
);
if
(!
updateResponse2
.
isSuccess
())
{
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
updateResponse2
.
getMessage
());
}
UpdateResponse
updateResponse3
=
mqConfigService
.
stopReadingMessage
(
0
==
readingMessageStopped
);
if
(!
updateResponse3
.
isSuccess
())
{
return
RestResponse
.
failure
(
ErrorCode
.
SYSTEM_ERROR
.
getCode
(),
updateResponse3
.
getMessage
());
}
return
RestResponse
.
success
();
}
}
\ No newline at end of file
gic-platform-operation-web/src/main/java/com/gic/operation/web/vo/RouterConsoleVO.java
0 → 100644
View file @
9b5c3341
package
com
.
gic
.
operation
.
web
.
vo
;
import
com.gic.mq.sdk.entity.MQConfigInfo
;
import
com.gic.mq.sdk.entity.MQStatusInfo
;
/**
*
* @Description:
* @author zhiwj
* @date 2020/2/13 17:04
*/
public
class
RouterConsoleVO
{
private
MQStatusInfo
mqStatusInfo
;
private
MQConfigInfo
mqConfigInfo
;
public
MQStatusInfo
getMqStatusInfo
()
{
return
mqStatusInfo
;
}
public
void
setMqStatusInfo
(
MQStatusInfo
mqStatusInfo
)
{
this
.
mqStatusInfo
=
mqStatusInfo
;
}
public
MQConfigInfo
getMqConfigInfo
()
{
return
mqConfigInfo
;
}
public
void
setMqConfigInfo
(
MQConfigInfo
mqConfigInfo
)
{
this
.
mqConfigInfo
=
mqConfigInfo
;
}
}
gic-platform-operation-web/src/main/resources/dubbo-gic-platform-operation-web.xml
View file @
9b5c3341
...
...
@@ -80,4 +80,7 @@
<!--链接小工具-->
<dubbo:reference
interface=
"com.gic.enterprise.service.LinkApiService"
id=
"linkApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.BusinessFrontResApiService"
id=
"businessFrontResApiService"
timeout=
"6000"
/>
<!-- 消息路由 -->
<dubbo:reference
interface=
"com.gic.mq.sdk.service.MQConfigService"
id=
"mQConfigService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.mq.sdk.service.MQStatusService"
id=
"mQStatusService"
timeout=
"6000"
/>
</beans>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment