Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
holmes
Commits
d875f7c3
Commit
d875f7c3
authored
Oct 11, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复mq同步不成功的问题
parent
f0007bcf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
MqService.java
src/main/java/cn/qg/holmes/service/k8s/MqService.java
+5
-4
HttpClientUtils.java
src/main/java/cn/qg/holmes/utils/HttpClientUtils.java
+4
-2
No files found.
src/main/java/cn/qg/holmes/service/k8s/MqService.java
View file @
d875f7c3
...
@@ -43,11 +43,12 @@ public class MqService {
...
@@ -43,11 +43,12 @@ public class MqService {
List
<
Map
<
String
,
String
>>
qaPermissionList
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
qaPermissionList
=
new
ArrayList
<>();
for
(
Map
<
String
,
String
>
permission
:
permissionList
)
{
for
(
Map
<
String
,
String
>
permission
:
permissionList
)
{
if
(
permission
.
get
(
"user"
).
equals
(
"rabbit_admin"
))
{
if
(
permission
.
get
(
"user"
).
equals
(
"rabbit_admin"
))
{
qaPermissionList
.
add
(
permission
);
Map
<
String
,
String
>
temp
=
new
HashMap
<>();
temp
.
putAll
(
permission
);
qaPermissionList
.
add
(
temp
);
permission
.
put
(
"user"
,
"qa"
);
permission
.
put
(
"user"
,
"qa"
);
qaPermissionList
.
add
(
permission
);
qaPermissionList
.
add
(
permission
);
}
}
else
if
(!
permission
.
get
(
"user"
).
equals
(
"qa"
)
&&
!
permission
.
get
(
"user"
).
equals
(
"rabbit_admin"
))
{
if
(!
permission
.
get
(
"user"
).
equals
(
"qa"
)
&&
!
permission
.
get
(
"user"
).
equals
(
"rabbit_admin"
))
{
qaPermissionList
.
add
(
permission
);
qaPermissionList
.
add
(
permission
);
}
}
}
}
...
@@ -134,6 +135,6 @@ public class MqService {
...
@@ -134,6 +135,6 @@ public class MqService {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
MqService
mqService
=
new
MqService
();
MqService
mqService
=
new
MqService
();
mqService
.
setDefinitions
(
"172.17.5.
17:31426
"
);
mqService
.
setDefinitions
(
"172.17.5.
46:32419
"
);
}
}
}
}
src/main/java/cn/qg/holmes/utils/HttpClientUtils.java
View file @
d875f7c3
...
@@ -171,7 +171,7 @@ public class HttpClientUtils {
...
@@ -171,7 +171,7 @@ public class HttpClientUtils {
public
static
String
doPostJson
(
String
url
,
Map
<
String
,
String
>
headers
,
String
json
)
{
public
static
String
doPostJson
(
String
url
,
Map
<
String
,
String
>
headers
,
String
json
)
{
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
httpResponse
=
null
;
CloseableHttpResponse
httpResponse
=
null
;
String
resultString
=
""
;
String
resultString
=
null
;
try
{
try
{
// 创建Http Post请求
// 创建Http Post请求
HttpPost
httpPost
=
new
HttpPost
(
url
);
HttpPost
httpPost
=
new
HttpPost
(
url
);
...
@@ -183,7 +183,9 @@ public class HttpClientUtils {
...
@@ -183,7 +183,9 @@ public class HttpClientUtils {
setHeader
(
headers
,
httpPost
);
setHeader
(
headers
,
httpPost
);
httpResponse
=
httpClient
.
execute
(
httpPost
);
httpResponse
=
httpClient
.
execute
(
httpPost
);
if
(
httpResponse
.
getEntity
()
!=
null
)
{
resultString
=
EntityUtils
.
toString
(
httpResponse
.
getEntity
(),
ENCODING
);
resultString
=
EntityUtils
.
toString
(
httpResponse
.
getEntity
(),
ENCODING
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
...
...
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