ActiveMQ without persistence

点点圈 提交于 2019-12-08 02:14:39

问题


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


回答1:


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




回答2:


In my case remove all of the kahadb data files from the following directory helps:

$ ls /var/lib/activemq/main/data$ cd kahadb
db-1.log  db.data  db.redo  lock

then:

sudo service activemq restart

and everything back to work




回答3:


if using maven pom, then switch to `

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-all</artifactId>
    <version>5.8.0</version>
</dependency>

` also don't forget to clear out the contents in KahaDB and Scheduler. it also helps to turn the scheduler off, if not needed.



来源:https://stackoverflow.com/questions/3951220/activemq-without-persistence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!