Joke Collection Website - Public benefit messages - What is the reason why activemq rewrites the message expiration method instead of the messageExpired method? I am

What is the reason why activemq rewrites the message expiration method instead of the messageExpired method? I am

Another problem with ActiveMQ is that as long as it is software, it may hang up. It's not terrible to hang up, but I'm afraid of losing information after hanging up. Therefore, this section analyzes several persistence methods:

One. Persistence as a file

By default, ActiveMQ supports this method as long as you set the message to be persistent when sending it.

Open the configuration file in the installation directory:

D: \ ActiveMQ \ Apache-ActiveMQ \ conf \ ActiveMQ.xml found the default configuration item after 80 lines:

& lt persistence adapter & gt

& ltkah ADB directory =“$ { ActiveMQ . data }/kah ADB“/& gt。

& lt/persistence adapter & gt;

Please note that kahaDB is used here, which is a file-based message memory, supports transactions, and is a reliable, high-performance and extensible message memory.

His original intention was to use it simply and quickly. KahaDB's index uses the transaction log, and all destinations use only one index. Some tests show that if it is used in a production environment, it supports 10000 active connections, and each connection has an independent queue. This performance is enough to meet most requirements.

Then change the second parameter to:

MsgDeliveryMode。 persistent

There are two ways to save messages.

Persistence: Save to disk, and the message will be deleted after consumption by consumers.

NON_PERSISTENT: Save to memory, and the message will be cleared after consumption.

Note: Accumulating too many messages may lead to memory overflow.

Then open the generator and send a message:

wps30F4.tmp

Do not start the consumer, and at the same time view in the management interface:

wps3 105.tmp

I found a message waiting. At this point, if there is no persistence, the message will be lost after restarting ActiveMQ, but now we modify it to file persistence, and consumers can still receive this message after restarting ActiveMQ.

wps3 106.tmp