我在使用SpringCloud框架重构我司的采集适配器时,使用的消息中间件有两个,一个是kafka,接收处理网关上报的原始数据。通过采集器的数据处理器之后,封装成为平台对象,发送到ActiveMq,进入平台业务系统。ActiveMq生产的功能,就简单使用Spring提供的jmsTemplate。但是在测试时发现了个问题。有天发现activeMq有些异常。
问题描述:
当采集器短时间内发送大量消息(每秒3万左右),查看activeMq的61616端口发现有大量activeMq的连接,多数都是阻塞状态
我们追踪jmsTemplate.convertAndSend(destination, message)放,最后进入ActiveMQMessageProducer.doSend方法:
ActiveMQMessageProducer
protected void doSend(Session session, Destination destination, MessageCreator messageCreator)
throws JMSException {
Assert.notNull(messageCreator, "MessageCreator must not be null");
MessageProducer producer = createProducer(sessio