| | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Slf4j |
| | | @Component//监听此队列 |
| | |
| | | */ |
| | | @RabbitListener(queues = "task_queue", concurrency = "50") |
| | | public void phoneVisit(String content, Message message, Channel channel) throws IOException { |
| | | log.error("消息进来了--------------"); |
| | | System.out.println("消息进来了----------------"); |
| | | IvrTaskcallMQ ivrTaskcallMQ = null; |
| | | try { |
| | | IvrTaskcallMQ ivrTaskcallMQ = null; |
| | | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | if (!content.contains("{")) { |
| | | if (!content.startsWith("{")) { |
| | | ivrTaskcallMQ = mapper.readValue("{" + content + "}", IvrTaskcallMQ.class); |
| | | } else { |
| | | ivrTaskcallMQ = mapper.readValue(content, IvrTaskcallMQ.class); |
| | |
| | | String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("4"); |
| | | sendMagParam.setUrl("192.168.2.10:8099/followvisit/particty?param1=" + taskId + "¶m2=" + patid); |
| | | sendMagParam.setUrl(req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid); |
| | | sendService.sendMsg(sendMagParam); |
| | | } |
| | | } else if (descByCode.equals("公众号")) { |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | Integer integer = redisCache.getCacheObject(ivrTaskcallMQ.getTaskid().toString()); |
| | | if (integer != null && integer == 2) { |
| | | channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); |
| | | } else if (integer == null) { |
| | | redisCache.setCacheObject(ivrTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | redisCache.setCacheObject(ivrTaskcallMQ.getTaskid().toString(), integer + 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | log.error("============消费失败,尝试消息补发再次消费!=============="); |
| | | log.error(e.getMessage()); |
| | | channel.basicReject(message.getMessageProperties().getDeliveryTag(), true); |