...
|
...
|
@@ -3,9 +3,12 @@ package com.yoho.search.consumer.index.increment.retry; |
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.yoho.search.consumer.index.increment.AbstractMqListener;
|
|
|
import com.yoho.search.core.message.SearchMessageHelper;
|
|
|
import com.yoho.search.core.message.beans.SearchMqBeansResgister;
|
|
|
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
|
|
|
import com.yoho.search.core.message.entity.SearchMqMessage;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -23,7 +26,7 @@ import com.yoho.search.consumer.service.bo.ProductIndexBO; |
|
|
import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService;
|
|
|
|
|
|
@Component
|
|
|
@SearchMqConsumerListerner(dbName = "retry",tableName = "productindex")
|
|
|
@SearchMqConsumerListerner(dbName = "search_default",tableName = "productindex")
|
|
|
public class ProductIndexMqListener extends AbstractMqListener {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ProductIndexMqListener.class);
|
...
|
...
|
@@ -36,6 +39,8 @@ public class ProductIndexMqListener extends AbstractMqListener { |
|
|
private ProductIndexBOToMapService productIndexBOToMapService;
|
|
|
@Autowired
|
|
|
private SearchMqBeansResgister searchMqBeansResgister;
|
|
|
@Autowired
|
|
|
private SearchMessageHelper searchMessageHelper;
|
|
|
|
|
|
@Override
|
|
|
public String getIndexName() {
|
...
|
...
|
@@ -82,19 +87,18 @@ public class ProductIndexMqListener extends AbstractMqListener { |
|
|
if (CollectionUtils.isEmpty(productIndexBOs)) {
|
|
|
return;
|
|
|
}
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("action", ISearchConstants.ACTION_UPDATE);
|
|
|
json.put("data", productIndexBOToMapService.beanToMap(productIndexBOs.get(0)));
|
|
|
//String channel = this.getChannel(this.getIndexName());
|
|
|
try {
|
|
|
// searchMqBeansResgister.getRabbitTemplate().convertAndSend(channel, json);
|
|
|
} catch (AmqpException e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// private String getChannel(String indexName) {
|
|
|
// return ISearchConstants.REDIS_CHANNEL_PRIFIX + indexName;
|
|
|
// SearchMqMessage searchMqMessage = new SearchMqMessage();
|
|
|
// searchMqMessage.setAction(ISearchConstants.ACTION_UPDATE);
|
|
|
// searchMqMessage.setData(productIndexBOToMapService.beanToMap(productIndexBOs.get(0)));
|
|
|
// searchMqMessage.setDbName("searchself");
|
|
|
// searchMqMessage.setTableName("productindex");
|
|
|
// searchMqMessage.setVersion(System.currentTimeMillis() * 1000);
|
|
|
// try {
|
|
|
// List<String> channel = searchMessageHelper.getTableQueueNames("searchself","productindex");
|
|
|
// searchMqBeansResgister.getRabbitTemplate().convertAndSend(channel.get(0),searchMqMessage);
|
|
|
// } catch (AmqpException e) {
|
|
|
// logger.error(e.getMessage(), e);
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|