ActiveMQ 没有持久性
我想在生成消息的服务器和接收消息的许多客户端之间建立基于发布者-订阅者的通信协议。经过一番研究后,我决定使用 ActiveMQ。我查看了一些教程和 ActiveMQ 站点,并按如下方式设置代理:
BrokerService broker = new BrokerService();
broker.setPersistent(false);
broker.addConnector("tcp://localhost:61616");
broker.start();
我只需要消息传递功能,不需要数据库持久性或类似的东西。但是,当我启动应用程序时,无论配置如何,都会创建一个 activemq-data 文件夹。这反过来会在我下次启动代理时导致异常。
SEVERE: Failed to start ActiveMQ JMS Message Broker. Reason: java.io.EOFException: Chunk stream does not exist at page: 0
这是一个错误还是我没有正确设置代理(使用 ActiveMQ 5.4.1)?如何禁用持久性,以便不创建额外的数据存储?另外,我更喜欢在 Java 应用程序中配置代理,而不是通过 xml 文件。
干杯, 最大限度
I'd like to set up a publisher-subscriber based communication protocol between a server producing messages and many clients receiving them. After a bit of research, I decided to go with ActiveMQ. I looked at a few tutorials and the ActiveMQ site and set up the broker as follows:
BrokerService broker = new BrokerService();
broker.setPersistent(false);
broker.addConnector("tcp://localhost:61616");
broker.start();
I only need the message passing functionality, no database persistence or anything alike. However, when I start the application, a activemq-data folder is created regardless of the the configuration. This in turn causes an exception the next time I start the broker.
SEVERE: Failed to start ActiveMQ JMS Message Broker. Reason: java.io.EOFException: Chunk stream does not exist at page: 0
Is this a bug or am I not setting up the broker correctly (using ActiveMQ 5.4.1)? How can I disable persistence, so the additional data storage is not created? Also, I prefer to configure the broker from within the Java application and not through an xml file.
Cheers,
Max
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您还可以为消息生产者设置传递模式。
JMS 允许的整数值为:
You can also set the delivery mode for your message producer.
Integer values allowed by JMS are:
这不是正常行为,而是 KahaDB(Activemq 中的默认持久性存储)中的一个错误。
您可以在 ActiveMQ 的错误 2935。
您可以通过选择不同的持久性引擎来解决这个问题,尽管我奇怪地遇到过这个问题几次,然后它就消失了
This is not normal behaviour but a bug in KahaDB (the default persistence store in Activemq)
You can see info on Bug 2935 of ActiveMQ.
You could solve this by choosing a different persistence engine, although i strangly had this problem a couple of times and then it dissapeared
就我而言,从以下目录中删除所有 kahadb 数据文件会有所帮助:
然后:
一切都恢复正常
In my case remove all of the kahadb data files from the following directory helps:
then:
and everything back to work
如果使用maven pom,则切换到
`
`
另外不要忘记清除KahaDB和Scheduler中的内容。
如果不需要的话,它还有助于关闭调度程序。
if using maven pom, then switch to
`
`
also don't forget to clear out the contents in KahaDB and Scheduler.
it also helps to turn the scheduler off, if not needed.