Commit 153b9d8b by 段启岩

搜索,消息队列对接成功

parent 525725ea
...@@ -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());
} }
} }
} }
...@@ -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();
......
...@@ -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
......
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
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: false debug: true
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
\ No newline at end of file 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