Showing
1 changed file
with
18 additions
and
14 deletions
@@ -3,9 +3,12 @@ package com.yoho.search.consumer.index.increment.retry; | @@ -3,9 +3,12 @@ package com.yoho.search.consumer.index.increment.retry; | ||
3 | import java.util.Arrays; | 3 | import java.util.Arrays; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | +import com.alibaba.fastjson.JSON; | ||
6 | import com.yoho.search.consumer.index.increment.AbstractMqListener; | 7 | import com.yoho.search.consumer.index.increment.AbstractMqListener; |
8 | +import com.yoho.search.core.message.SearchMessageHelper; | ||
7 | import com.yoho.search.core.message.beans.SearchMqBeansResgister; | 9 | import com.yoho.search.core.message.beans.SearchMqBeansResgister; |
8 | import com.yoho.search.core.message.beans.SearchMqConsumerListerner; | 10 | import com.yoho.search.core.message.beans.SearchMqConsumerListerner; |
11 | +import com.yoho.search.core.message.entity.SearchMqMessage; | ||
9 | import org.apache.commons.collections.CollectionUtils; | 12 | import org.apache.commons.collections.CollectionUtils; |
10 | import org.apache.commons.lang3.StringUtils; | 13 | import org.apache.commons.lang3.StringUtils; |
11 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
@@ -23,7 +26,7 @@ import com.yoho.search.consumer.service.bo.ProductIndexBO; | @@ -23,7 +26,7 @@ import com.yoho.search.consumer.service.bo.ProductIndexBO; | ||
23 | import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService; | 26 | import com.yoho.search.consumer.service.logicService.ProductIndexBOToMapService; |
24 | 27 | ||
25 | @Component | 28 | @Component |
26 | -@SearchMqConsumerListerner(dbName = "retry",tableName = "productindex") | 29 | +@SearchMqConsumerListerner(dbName = "search_default",tableName = "productindex") |
27 | public class ProductIndexMqListener extends AbstractMqListener { | 30 | public class ProductIndexMqListener extends AbstractMqListener { |
28 | 31 | ||
29 | private static final Logger logger = LoggerFactory.getLogger(ProductIndexMqListener.class); | 32 | private static final Logger logger = LoggerFactory.getLogger(ProductIndexMqListener.class); |
@@ -36,6 +39,8 @@ public class ProductIndexMqListener extends AbstractMqListener { | @@ -36,6 +39,8 @@ public class ProductIndexMqListener extends AbstractMqListener { | ||
36 | private ProductIndexBOToMapService productIndexBOToMapService; | 39 | private ProductIndexBOToMapService productIndexBOToMapService; |
37 | @Autowired | 40 | @Autowired |
38 | private SearchMqBeansResgister searchMqBeansResgister; | 41 | private SearchMqBeansResgister searchMqBeansResgister; |
42 | + @Autowired | ||
43 | + private SearchMessageHelper searchMessageHelper; | ||
39 | 44 | ||
40 | @Override | 45 | @Override |
41 | public String getIndexName() { | 46 | public String getIndexName() { |
@@ -82,19 +87,18 @@ public class ProductIndexMqListener extends AbstractMqListener { | @@ -82,19 +87,18 @@ public class ProductIndexMqListener extends AbstractMqListener { | ||
82 | if (CollectionUtils.isEmpty(productIndexBOs)) { | 87 | if (CollectionUtils.isEmpty(productIndexBOs)) { |
83 | return; | 88 | return; |
84 | } | 89 | } |
85 | - JSONObject json = new JSONObject(); | ||
86 | - json.put("action", ISearchConstants.ACTION_UPDATE); | ||
87 | - json.put("data", productIndexBOToMapService.beanToMap(productIndexBOs.get(0))); | ||
88 | - //String channel = this.getChannel(this.getIndexName()); | ||
89 | - try { | ||
90 | - // searchMqBeansResgister.getRabbitTemplate().convertAndSend(channel, json); | ||
91 | - } catch (AmqpException e) { | ||
92 | - logger.error(e.getMessage(), e); | ||
93 | - } | ||
94 | - } | ||
95 | - | ||
96 | -// private String getChannel(String indexName) { | ||
97 | -// return ISearchConstants.REDIS_CHANNEL_PRIFIX + indexName; | 90 | +// SearchMqMessage searchMqMessage = new SearchMqMessage(); |
91 | +// searchMqMessage.setAction(ISearchConstants.ACTION_UPDATE); | ||
92 | +// searchMqMessage.setData(productIndexBOToMapService.beanToMap(productIndexBOs.get(0))); | ||
93 | +// searchMqMessage.setDbName("searchself"); | ||
94 | +// searchMqMessage.setTableName("productindex"); | ||
95 | +// searchMqMessage.setVersion(System.currentTimeMillis() * 1000); | ||
96 | +// try { | ||
97 | +// List<String> channel = searchMessageHelper.getTableQueueNames("searchself","productindex"); | ||
98 | +// searchMqBeansResgister.getRabbitTemplate().convertAndSend(channel.get(0),searchMqMessage); | ||
99 | +// } catch (AmqpException e) { | ||
100 | +// logger.error(e.getMessage(), e); | ||
98 | // } | 101 | // } |
102 | + } | ||
99 | 103 | ||
100 | } | 104 | } |
-
Please register or login to post a comment