Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
段启岩
beyond-clouds
Commits
153b9d8b
Commit
153b9d8b
authored
Feb 09, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索,消息队列对接成功
parent
525725ea
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
5 deletions
+86
-5
src/main/java/cn/meteor/beyondclouds/modules/queue/service/impl/MessageQueueServiceImpl.java
+2
-1
src/main/java/cn/meteor/beyondclouds/modules/search/listener/impl/SearchItemUpdateListener.java
+1
-1
src/main/java/cn/meteor/beyondclouds/modules/search/service/impl/SearchServiceImpl.java
+3
-0
src/main/resources/application-dev.yml
+39
-1
src/main/resources/application-prod.yml
+41
-2
No files found.
src/main/java/cn/meteor/beyondclouds/modules/queue/service/impl/MessageQueueServiceImpl.java
View file @
153b9d8b
...
@@ -30,9 +30,10 @@ public class MessageQueueServiceImpl implements IMessageQueueService {
...
@@ -30,9 +30,10 @@ public class MessageQueueServiceImpl implements IMessageQueueService {
public
void
sendItemUpdateMessage
(
DataItemUpdateMessage
itemUpdateMessage
)
{
public
void
sendItemUpdateMessage
(
DataItemUpdateMessage
itemUpdateMessage
)
{
try
{
try
{
kafkaTemplate
.
send
(
topicProperties
.
getSearchItemUpdate
(),
JsonUtils
.
toJson
(
itemUpdateMessage
));
kafkaTemplate
.
send
(
topicProperties
.
getSearchItemUpdate
(),
JsonUtils
.
toJson
(
itemUpdateMessage
));
log
.
debug
(
"发送kafka消息:{}"
,
itemUpdateMessage
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"Kafka消息发送失败:"
,
e
.
getMessage
());
log
.
error
(
"Kafka消息发送失败:
{}
"
,
e
.
getMessage
());
}
}
}
}
}
}
src/main/java/cn/meteor/beyondclouds/modules/search/listener/impl/SearchItemUpdateListener.java
View file @
153b9d8b
...
@@ -38,7 +38,7 @@ public class SearchItemUpdateListener implements ISearchItemUpdateListener {
...
@@ -38,7 +38,7 @@ public class SearchItemUpdateListener implements ISearchItemUpdateListener {
try
{
try
{
itemUpdateMessage
=
JsonUtils
.
toBean
(
kafkaMessage
.
get
(),
DataItemUpdateMessage
.
class
);
itemUpdateMessage
=
JsonUtils
.
toBean
(
kafkaMessage
.
get
(),
DataItemUpdateMessage
.
class
);
log
.
debug
(
"
new searchItemUpdateMessage:
{}"
,
itemUpdateMessage
.
toString
());
log
.
debug
(
"
接收到kafka消息:
{}"
,
itemUpdateMessage
.
toString
());
// 处理搜索条目更新
// 处理搜索条目更新
SearchItemUpdateType
updateType
=
itemUpdateMessage
.
getUpdateType
();
SearchItemUpdateType
updateType
=
itemUpdateMessage
.
getUpdateType
();
...
...
src/main/java/cn/meteor/beyondclouds/modules/search/service/impl/SearchServiceImpl.java
View file @
153b9d8b
...
@@ -57,18 +57,21 @@ public class SearchServiceImpl implements ISearchService {
...
@@ -57,18 +57,21 @@ public class SearchServiceImpl implements ISearchService {
SearchItem
searchItem
=
getSearchItemInDb
(
itemType
,
itemId
);
SearchItem
searchItem
=
getSearchItemInDb
(
itemType
,
itemId
);
if
(
null
!=
searchItem
)
{
if
(
null
!=
searchItem
)
{
searchRepository
.
save
(
searchItem
);
searchRepository
.
save
(
searchItem
);
log
.
debug
(
"elasticsearch-save:{}"
,
searchItem
);
}
}
}
}
@Override
@Override
public
void
deleteSearchItem
(
SearchItemType
itemType
,
String
itemId
)
{
public
void
deleteSearchItem
(
SearchItemType
itemType
,
String
itemId
)
{
searchRepository
.
deleteById
(
SearchItemId
.
of
(
itemType
,
itemId
));
searchRepository
.
deleteById
(
SearchItemId
.
of
(
itemType
,
itemId
));
log
.
debug
(
"elasticsearch-delete:{}"
,
SearchItemId
.
of
(
itemType
,
itemId
));
}
}
@Override
@Override
public
void
updateSearchItem
(
SearchItemType
itemType
,
String
itemId
)
{
public
void
updateSearchItem
(
SearchItemType
itemType
,
String
itemId
)
{
SearchItem
searchItem
=
getSearchItemInDb
(
itemType
,
itemId
);
SearchItem
searchItem
=
getSearchItemInDb
(
itemType
,
itemId
);
searchRepository
.
save
(
searchItem
);
searchRepository
.
save
(
searchItem
);
log
.
debug
(
"elasticsearch-update:{}"
,
searchItem
);
}
}
@Override
@Override
...
...
src/main/resources/application-dev.yml
View file @
153b9d8b
spring
:
spring
:
# 数据源
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
username
:
beyond
username
:
beyond
password
:
Beyond2020#
password
:
Beyond2020#
# 邮箱
mail
:
mail
:
host
:
smtp.163.com
host
:
smtp.163.com
username
:
13546386889@163.com
username
:
13546386889@163.com
...
@@ -21,10 +25,32 @@ spring:
...
@@ -21,10 +25,32 @@ spring:
socketFactory
:
socketFactory
:
fallback
:
false
fallback
:
false
# elasticsearch
data
:
elasticsearch
:
repositories
:
enabled
:
false
elasticsearch
:
rest
:
uris
:
http://localhost:9200
# kafka
kafka
:
bootstrap-servers
:
127.0.0.1:9092
producer
:
key-serializer
:
org.apache.kafka.common.serialization.StringSerializer
value-serializer
:
org.apache.kafka.common.serialization.StringSerializer
consumer
:
group-id
:
beyond-clouds
enable-auto-commit
:
true
key-serializer
:
org.apache.kafka.common.serialization.StringSerializer
value-serializer
:
org.apache.kafka.common.serialization.StringSerializer
# swagger
swagger
:
swagger
:
enable
:
true
enable
:
true
# 阿里云
aliyun
:
aliyun
:
access-key-id
:
LTAIeHWeydaWT3ZZ
access-key-id
:
LTAIeHWeydaWT3ZZ
access-key-secret
:
2FTWlODpzEZjsBQw10NO6SUBMwYOcL
access-key-secret
:
2FTWlODpzEZjsBQw10NO6SUBMwYOcL
...
@@ -39,9 +65,17 @@ aliyun:
...
@@ -39,9 +65,17 @@ aliyun:
region-id
:
cn-hangzhou
region-id
:
cn-hangzhou
sign-name
:
段启岩
sign-name
:
段启岩
template-code-map
:
{
verifyCode
:
SMS_142384912
}
template-code-map
:
{
verifyCode
:
SMS_142384912
}
# mybatis-plus
mybatis-plus
:
mybatis-plus
:
mapper-locations
:
classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
mapper-locations
:
classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
logging
:
level
:
cn
:
meteor
:
beyondclouds
:
debug
# 云里云外
beyondclouds
:
beyondclouds
:
debug
:
true
debug
:
true
auth
:
auth
:
...
@@ -49,3 +83,6 @@ beyondclouds:
...
@@ -49,3 +83,6 @@ beyondclouds:
client-id
:
101846021
client-id
:
101846021
client-secret
:
5bc41deeb7e152e2e6aff97726bbf86a
client-secret
:
5bc41deeb7e152e2e6aff97726bbf86a
redirect-uri
:
http://meteor.natapp1.cc/auth/qq
redirect-uri
:
http://meteor.natapp1.cc/auth/qq
kafka
:
topics
:
search-item-update
:
topic.beyondclouds.searchitem.update
\ No newline at end of file
src/main/resources/application-prod.yml
View file @
153b9d8b
spring
:
spring
:
# 数据源
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://127.0.0.1:3306/beyond_clouds?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true
username
:
beyond
username
:
beyond
password
:
Beyond2020#
password
:
Beyond2020#
# 邮箱
mail
:
mail
:
host
:
smtp.163.com
host
:
smtp.163.com
username
:
13546386889@163.com
username
:
13546386889@163.com
...
@@ -20,10 +24,33 @@ spring:
...
@@ -20,10 +24,33 @@ spring:
ssl
:
ssl
:
socketFactory
:
socketFactory
:
fallback
:
false
fallback
:
false
# elasticsearch
data
:
elasticsearch
:
repositories
:
enabled
:
false
elasticsearch
:
rest
:
uris
:
http://localhost:9200
# kafka
kafka
:
bootstrap-servers
:
127.0.0.1:9092
producer
:
key-serializer
:
org.apache.kafka.common.serialization.StringSerializer
value-serializer
:
org.apache.kafka.common.serialization.StringSerializer
consumer
:
group-id
:
beyond-clouds
enable-auto-commit
:
true
key-serializer
:
org.apache.kafka.common.serialization.StringSerializer
value-serializer
:
org.apache.kafka.common.serialization.StringSerializer
# swagger
swagger
:
swagger
:
enable
:
true
enable
:
true
# 阿里云
aliyun
:
aliyun
:
access-key-id
:
LTAIeHWeydaWT3ZZ
access-key-id
:
LTAIeHWeydaWT3ZZ
access-key-secret
:
2FTWlODpzEZjsBQw10NO6SUBMwYOcL
access-key-secret
:
2FTWlODpzEZjsBQw10NO6SUBMwYOcL
...
@@ -38,13 +65,24 @@ aliyun:
...
@@ -38,13 +65,24 @@ aliyun:
region-id
:
cn-hangzhou
region-id
:
cn-hangzhou
sign-name
:
段启岩
sign-name
:
段启岩
template-code-map
:
{
verifyCode
:
SMS_142384912
}
template-code-map
:
{
verifyCode
:
SMS_142384912
}
# mybatis-plus
mybatis-plus
:
mybatis-plus
:
mapper-locations
:
classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
mapper-locations
:
classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
logging
:
level
:
cn
:
meteor
:
beyondclouds
:
debug
# 云里云外
beyondclouds
:
beyondclouds
:
debug
:
fals
e
debug
:
tru
e
auth
:
auth
:
qq
:
qq
:
client-id
:
101846021
client-id
:
101846021
client-secret
:
5bc41deeb7e152e2e6aff97726bbf86a
client-secret
:
5bc41deeb7e152e2e6aff97726bbf86a
redirect-uri
:
http://meteor.natapp1.cc/auth/qq
redirect-uri
:
http://meteor.natapp1.cc/auth/qq
kafka
:
topics
:
search-item-update
:
topic.beyondclouds.searchitem.update
\ 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