2

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

Max
  • 27
  • 1
  • 4
  • For now I found a workaround of deleting the folder every time I start the broker/publisher. Would be great if anyone could shed some light on that issue anyway. – Max Oct 17 '10 at 09:32

4 Answers4

2

You can also set the delivery mode for your message producer.

messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

Integer values allowed by JMS are:

    int NON_PERSISTENT = 1;
    int PERSISTENT = 2;
Rudraksh
  • 91
  • 1
  • 5
1

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

wierzbiks
  • 1,148
  • 10
  • 10
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

рüффп
  • 5,172
  • 34
  • 67
  • 113
Noctris
  • 554
  • 3
  • 17
  • Thanks for your reply. Changing the persistence store would add another dependency for something I don't intend to use. – Max Oct 29 '10 at 00:06
  • so basically you do not want persistence and it's not taking the code configuration. What i've read is that the setting will be ignored when a persistence adapter is set. Maybe you could try clearing the adapters ( incase one has been set by default, altough looking at the source, it uses the MemoryPersistence) before starting ? Other then that, i would say it is a bug an needs to be registered in jira :s – Noctris Oct 29 '10 at 10:10
  • As I said, I don't want to introduce another dependency (for MemoryPersistence). I guess I just have to wait until 5.5 is going to be released. Postings in the bug report suggest that the bug will be fixed in this version. – Max Nov 03 '10 at 21:39
  • Looks like this was fixed in 5.4.2. – Ed Thomas Apr 04 '11 at 15:07
0

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.

vamsi-vegi
  • 305
  • 1
  • 3
  • 16