Commit 153b9d8b by 段启岩

搜索,消息队列对接成功

parent 525725ea
......@@ -30,9 +30,10 @@ public class MessageQueueServiceImpl implements IMessageQueueService {
public void sendItemUpdateMessage(DataItemUpdateMessage itemUpdateMessage) {
try {
kafkaTemplate.send(topicProperties.getSearchItemUpdate(), JsonUtils.toJson(itemUpdateMessage));
log.debug("发送kafka消息:{}", itemUpdateMessage.toString());
} catch (Exception e) {
e.printStackTrace();
log.error("Kafka消息发送失败:", e.getMessage());
log.error("Kafka消息发送失败:{}", e.getMessage());
}
}
}
......@@ -38,7 +38,7 @@ public class SearchItemUpdateListener implements ISearchItemUpdateListener {
try {
itemUpdateMessage = JsonUtils.toBean(kafkaMessage.get(), DataItemUpdateMessage.class);
log.debug("new searchItemUpdateMessage:{}", itemUpdateMessage.toString());
log.debug("接收到kafka消息:{}", itemUpdateMessage.toString());
// 处理搜索条目更新
SearchItemUpdateType updateType = itemUpdateMessage.getUpdateType();
......
......@@ -57,18 +57,21 @@ public class SearchServiceImpl implements ISearchService {
SearchItem searchItem = getSearchItemInDb(itemType, itemId);
if (null != searchItem) {
searchRepository.save(searchItem);
log.debug("elasticsearch-save:{}", searchItem);
}
}
@Override
public void deleteSearchItem(SearchItemType itemType, String itemId) {
searchRepository.deleteById(SearchItemId.of(itemType, itemId));
log.debug("elasticsearch-delete:{}", SearchItemId.of(itemType, itemId));
}
@Override
public void updateSearchItem(SearchItemType itemType, String itemId) {
SearchItem searchItem = getSearchItemInDb(itemType, itemId);
searchRepository.save(searchItem);
log.debug("elasticsearch-update:{}", searchItem);
}
@Override
......
spring:
# 数据源
datasource:
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
username: beyond
password: Beyond2020#
# 邮箱
mail:
host: smtp.163.com
username: 13546386889@163.com
......@@ -21,10 +25,32 @@ spring:
socketFactory:
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:
enable: true
# 阿里云
aliyun:
access-key-id: LTAIeHWeydaWT3ZZ
access-key-secret: 2FTWlODpzEZjsBQw10NO6SUBMwYOcL
......@@ -39,9 +65,17 @@ aliyun:
region-id: cn-hangzhou
sign-name: 段启岩
template-code-map: {verifyCode: SMS_142384912}
# mybatis-plus
mybatis-plus:
mapper-locations: classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
logging:
level:
cn:
meteor:
beyondclouds: debug
# 云里云外
beyondclouds:
debug: true
auth:
......@@ -49,3 +83,6 @@ beyondclouds:
client-id: 101846021
client-secret: 5bc41deeb7e152e2e6aff97726bbf86a
redirect-uri: http://meteor.natapp1.cc/auth/qq
kafka:
topics:
search-item-update: topic.beyondclouds.searchitem.update
\ No newline at end of file
spring:
# 数据源
datasource:
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
username: beyond
password: Beyond2020#
# 邮箱
mail:
host: smtp.163.com
username: 13546386889@163.com
......@@ -20,10 +24,33 @@ spring:
ssl:
socketFactory:
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:
enable: true
# 阿里云
aliyun:
access-key-id: LTAIeHWeydaWT3ZZ
access-key-secret: 2FTWlODpzEZjsBQw10NO6SUBMwYOcL
......@@ -38,13 +65,24 @@ aliyun:
region-id: cn-hangzhou
sign-name: 段启岩
template-code-map: {verifyCode: SMS_142384912}
# mybatis-plus
mybatis-plus:
mapper-locations: classpath*:cn/meteor/beyondclouds/modules/**/xml/*.xml
logging:
level:
cn:
meteor:
beyondclouds: debug
# 云里云外
beyondclouds:
debug: false
debug: true
auth:
qq:
client-id: 101846021
client-secret: 5bc41deeb7e152e2e6aff97726bbf86a
redirect-uri: http://meteor.natapp1.cc/auth/qq
kafka:
topics:
search-item-update: topic.beyondclouds.searchitem.update
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment