How can I fix blocking issue on a new install of ActiveMQ Artemis?
Asked Answered
P

3

10

I've been tasked with evaluating ActiveMQ Artemis for JMS clients. I have RabbmitMQ experience, but none with ActiveMQ Artemis & JMS.

I installed Artemis to my local machine, created a new broker per the instructions, and set it up as a Windows service. The Windows service starts and stops just fine. I've made no changes to the broker.xml file.

For my first test I'm trying to perform a JMS queue produce/consume from a stand alone Java program. I'm using the code from the Artemis User Manual in the Using JMS section, (without using JNDI):

TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF,transportConfiguration);

Queue orderQueue = ActiveMQJMSClient.createQueue("OrderQueue");
Connection connection = cf.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

MessageProducer producer = session.createProducer(orderQueue);
MessageConsumer consumer = session.createConsumer(orderQueue);

connection.start();

TextMessage message = session.createTextMessage("This is an order");
producer.send(message);

TextMessage receivedMessage = (TextMessage)consumer.receive();
System.out.println("Got order: " + receivedMessage.getText());

When I run this code, I get the following error:

WARN: AMQ212054: Destination address=jms.queue.OrderQueue is blocked. If the system is configured to block make sure you consume messages on this configuration.

My research hasn't been conclusive on if this is a server side setting, or having the producer send without blocking. I haven't been able to find a producer send method that has a blocking boolean, only persistence. Any ideas on where to focus? Thanks.

Edit: new address-setting element added to broker.xml dedicated to this queue:

<address-setting match="jms.queue.OrderQueue">
    <max-size-bytes>104857600</max-size-bytes>
    <page-size-bytes>10485760</page-size-bytes>
    <address-full-policy>PAGE</address-full-policy>
</address-setting>
Painter answered 23/6, 2017 at 16:32 Comment(1)
Even though AMQ212054 warn message, did the consumer managed to read the TextMessage?Tenuis
P
22

I found this on further research in the user manual:

max-disk-usage The max percentage of data we should use from disks. The System will block while the disk is full. Default=100

and in the log after service startup with no messages published yet:

WARN [org.apache.activemq.artemis.core.server] AMQ222210: Storage usage is beyond max-disk-usage. System will start blocking producers.

so I think no matter my address settings, it would start to block. Looking at the max-disk-usage setting in broker.xml, it was set to 90. Documentation default says 100, I set to that, no startup log warnings, and my test pub/sub code now works.

Painter answered 29/6, 2017 at 22:25 Comment(1)
It's worth noting that the default value for max-disk-usage referenced by the documentation is the code default so that if you don't set <max-disk-usage> in broker.xml it will be 100. However, the broker.xml output by the create command uses 90 for <max-disk-usage>.Submerse
P
0

This warn message comes when address policy set to BLOCK and memory reached. Check address policy set in broker.xml. If it is set to BLOCK, change it to PAGE. Or consume pending messages from OrderQueue.

Phyto answered 26/6, 2017 at 17:37 Comment(2)
Thanks for this, I checked this, and both address-setting entries are set to PAGE for address-full-policy. I did some further searching and came across this page: communities.ca.com/thread/241725820 My broker.xml was missing the max-size-bytes and page-size-bytes entries, so I added those. But now the Broker won't start up with those added, I get a windows service startup error.Painter
It was a generic service won't start message. However, I did some research at the link you provided. I added an additional address-setting element dedicated to this queue (see original post for new element) The broker starts fine now, but I'm still getting the blocking message.Painter
R
0

By default max-disk-usage value is set as 90(%) and if the remaining free space size is less than 10%, then this warn message will be shown and no messages will be received until you adjust the parameter or free up space beyond 10%.

Representation answered 6/1, 2023 at 11:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.