Artemis 1.2.0 独立代理配置:
<address-full-policy>PAGE</address-full-policy>
<page-size-bytes>1048576</page-size-bytes>
其他设置为默认设置。
“ tcp://localhost:61616 ” - 是“artemis”多协议接受器
正常情况:
行为:分页有效。
客户端:artemis-jms-client v1.2.0
类:org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616", user, pass);
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue("tmpQueue");
MessageProducer producer = session.createProducer(queue);
connection.start();
byte[] bytes = new byte[Integer.parseInt(size)];
Random random = new Random();
whilt (true) {
BytesMessage bytesMessage = session.createBytesMessage();
random.nextBytes(bytes);
bytesMessage.writeBytes(bytes);
producer.send(bytesMessage);
}
错误案例:
行为:分页不起作用。当消息将队列填充到 max-size-bytes 设置时,JMX 的 Address.Paging 变为 true,创建页面文件,页面文件计数变为 1,但生产者冻结,直到消费者开始工作。日志告诉分页正在开始,所以应该没问题,但 id 没有。即使我设置了跟踪级别,也没有其他消息。
客户端:activemq-client v5.12.0(也试过最新的5.13.2,没区别)
类:org.apache.activemq.ActiveMQConnectionFactory
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, pass, "tcp://localhost:61616");
// the same code after ConnectionFactory as for artemis-jms-client ...
这是虫子还是我煮错了?