SpringBoot 项目的两个不同模块之间
//线程池
private static ExecutorService executorService = new ThreadPoolExecutor(2, 200, 5, TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(200), new ThreadPoolExecutor.DiscardOldestPolicy());
/**
* 发送通知
* @param list
*/
public void sendTeacherMsg(List<xxxPo> list) {
executorService.submit(new Runnable() {
@Override
public void run() {
queueSender.send("xxx.xxxSender", JSON.toJSONString(list));
logger.info("成功发送了一条 JMS 消息, List<xxxPo>总个数:" + JSON.toJSONString(list.size()));
}
});
}
/**
* @description 信息消息监听
*/
@JmsListener(destination = "xxx.xxxSender")
@Override
public void onMessage(Message message) {
try {
System.out.println("接受到了了");
List<xxxPo> list = JSONObject.parseObject(((ObjectMessage) message).getObject().toString(), new TypeReference<List<xxxPo>>(){}.getType());
} catch (JMSException e) {
e.printStackTrace();
log.error("QylZuowenListener 获取 JMS 消息失败", e);
}
}
发送端定时发送一次 但是,接收端却意外接受到 7 次,重启两个模块也还是这样
请问这个怎么解决