I'm working on a Spring Boot project at the moment, this text keeps being printed to the console every second for thirty seconds before stopping.
15:18:02.416 o.a.activemq.broker.TransportConnector : Connector vm://localhost started
15:18:03.480 o.a.activemq.broker.TransportConnector : Connector vm://localhost stopped
15:18:03.480 o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.10.1 (localhost, ID:Jordan-801993-L.local-55074-1432703875573-0:7) is shutting down
15:18:03.481 o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.10.1 (localhost, ID:Jordan-801993-L.local-55074-1432703875573-0:7) uptime 1.069 seconds
15:18:03.481 o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.10.1 (localhost, ID:Jordan-801993-L.local-55074-1432703875573-0:7) is shutdown
15:18:03.542 o.apache.activemq.broker.BrokerService : Using Persistence Adapter: MemoryPersistenceAdapter
15:18:03.543 o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.10.1 (localhost, ID:Jordan-801993-L.local-55074-1432703875573-0:8) is starting
15:18:03.543 o.apache.activemq.broker.BrokerService : Apache ActiveMQ 5.10.1 (localhost, ID:Jordan-801993-L.local-55074-1432703875573-0:8) started
15:18:03.543 o.apache.activemq.broker.BrokerService : For help or more information please see: http://activemq.apache.org
15:18:03.544 o.a.a.broker.jmx.ManagementContext : JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
15:18:03.544 o.a.activemq.broker.TransportConnector : Connector vm://localhost started
The project still works fine, it's just annoying. Anyone know why this would be happening?
Met the same problem but the accepted answer did not help. Found the thread with explanation
ActiveMQ will only keep an in-memory queue alive if there is something holding onto it.
If the Queue has been setup in spring to not cache the queue then ActiveMQ will keep starting/stopping the connector. A full appserver would effectively cache queue stuff in a pool, thus keeping it alive.
Stick in the bean def for the Spring JMS container (org.springframework.jms.listener.DefaultMessageLi stenerContainer) to fix the problem.
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
DefaultJmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
factory.setCacheLevelName("CACHE_CONNECTION"); //<-- the line fixed the problem
configurer.configure(factory, connectionFactory);
return factory;
}
I cannot explain in-depth why this happens, but it has something to do with the way the ConnectionFactory
is auto-configured.
One way to get rid of this constant restarting of the embedded broker is to enable pooling in your application.properties
:
spring.activemq.pooled=true
In order to use this you also have to add the following dependency to your pom.xml
:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
</dependency>
I've dug through some documentation and eventually found this
At the bottom of the page it reads:
Using ActiveMQConnectionFactory
...
The broker will be created upon creation of the first connection.
...
Again, this doesn't fully explain what's going on, but I stopped digging once I found that enabling pooling stopped this behaviour from happening.
We have spring boot 1.5 services which consume and publish via JMSTemplate and do not have this problem and then we have one which only publishes (so no JmsListener) and fills logs with these messages - plus the related WARN Temporary Store limit is 51200 mb ... resetting to maximum available disk space
- writing them on every GET to /healthcheck. You'll want to consider the implications but this behaviour and hence all the related logging can be disabled with the property setting:
management.health.jms.enabled=false
You'll see the jms
block disappear from your /healthcheck
output as a result - so check whether it is actually reflecting anything required by your service.
We had no success with other answers on this thread nor with those we tried from Startup error of embedded ActiveMQ: Temporary Store limit is 51200 mb.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With