【问题标题】:How can I fix a new ActiveMQ Artemis install blocking issue?如何修复新的 ActiveMQ Artemis 安装阻塞问题?
【发布时间】:2017-11-27 07:32:11
【问题描述】:

我的任务是为 JMS 客户端评估 ActiveMQ Artemis。我有 RabbitMQ 经验,但没有使用 ActiveMQ Artemis。

我在本地机器上安装了 Artemis,按照说明创建了一个新代理,并将其设置为 Windows 服务。 Windows 服务可以正常启动和停止。我没有对broker.xml 文件进行任何更改。

对于我的第一个测试,我尝试从一个独立的 Java 程序执行 JMS 队列生产/消费。我在“使用 JMS”部分使用 Artemis 用户手册中的代码(不使用 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());

当我运行此代码时,我收到以下错误:

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

我的研究尚未确定这是服务器端设置,还是让生产者无阻塞地发送。我一直无法找到具有阻塞布尔值的生产者发送方法,只有持久性。对重点关注的地方有什么想法吗?

编辑:新的address-setting 元素添加到broker.xml 专用于此队列:

<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>

【问题讨论】:

  • 即使 AMQ212054 警告消息,消费者是否设法读取了 TextMessage?

标签: jms activemq-artemis


【解决方案1】:

我在用户手册的进一步研究中发现了这一点:

max-disk-usage 我们应该使用磁盘数据的最大百分比。 磁盘已满时系统将阻塞。默认=100

在服务启动后的日志中还没有发布任何消息:

警告 [org.apache.activemq.artemis.core.server] AMQ222210:存储使用量超出最大磁盘使用量。系统将开始阻止生产者。

所以我认为无论我的地址设置如何,它都会开始阻塞。查看 broker.xml 中的 max-disk-usage 设置,它设置为 90。文档默认设置为 100,我设置为该值,没有启动日志警告,我的测试 pub/sub 代码现在可以工作了。

【讨论】:

    【解决方案2】:

    当地址策略设置为 BLOCK 并达到内存时,会出现此警告消息。检查在 broker.xml 中设置的address policy。如果设置为 BLOCK,请将其更改为 PAGE。或者使用 OrderQueue 中的待处理消息。

    【讨论】:

    • 谢谢你,我检查了这个,两个地址设置条目都设置为地址完整策略的 PAGE。我做了一些进一步的搜索,发现了这个页面:communities.ca.com/thread/241725820我的 broker.xml 缺少 max-size-bytes 和 page-size-bytes 条目,所以我添加了这些。但是现在Broker不会启动那些添加的,我得到一个windows服务启动错误。
    • 这是一条通用服务无法启动的消息。但是,我对您提供的链接进行了一些研究。我添加了一个专用于该队列的附加地址设置元素(有关新元素,请参阅原始帖子)代理现在开始正常,但我仍然收到阻塞消息。
    猜你喜欢
    • 2019-11-15
    • 2021-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多