When adding messages to a queue in an ActiveMQ broker where there is no subscriber the queue fills up and eventually the producer thread hangs, unable to publish any more messages.
In an attempt to resolve the problem I set an expiry on the messages, thinking that this would free up memory but unfortunately this doesn't work. Does anyone know how I can resolve the issue?
My broker ActiveMQ version is 5.7 and broker definition is:
<bean id="mqBroker" class="org.apache.activemq.broker.BrokerService" init-method="start" destroy-method="stop">
<property name="brokerName" value = "mainBroker"/>
<property name="persistent" value="false"/>
<property name="useJmx" value="false"/>
<property name="transportConnectorURIs">
<list>
<value>tcp://localhost:7000</value>
</list>
</property>
</bean>
Looking in JConsole when it's unable to publish any more messages to the broker the memory usage looks fine (0% usage) and expired count=published count.
The code I'm using to publish messages is with spring integration:
<jms:outbound-channel-adapter
channel="jsonChannel"
connection-factory="jmsConnectionFactory"
pub-sub-domain="false"
destination-name="MY_QUEUE"
time-to-live="60000"
wxplicit-qos-enabled="true" />