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>
Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
user640118
  • 803
  • 2
  • 13
  • 25

3 Answers3

21

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.

user640118
  • 803
  • 2
  • 13
  • 25
  • 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 `` in `broker.xml` it will be `100`. However, the `broker.xml` output by the `create` command uses `90` for ``. – Justin Bertram Mar 28 '23 at 17:07
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.

Varsha
  • 1,150
  • 9
  • 12
  • 1
    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: https://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. – user640118 Jun 26 '17 at 20:42
  • 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. – user640118 Jun 27 '17 at 17:50
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%.