Starting with 5.3.1, ActiveMQ provides configurable IOException handling for its file-based message stores. From version 5.5 the handler is also invoked when the JDBC persistence adapter gets a failure on Default IOException handlerActiveMQ comes with a default IOException handler, which does the following. When some of the file-based message stores encounter IOException it can be one of the two things: either the disk is unavailable of there's no more space on the disk. The first case is usually encountered when disk fails or network disk is disconnected. These errors are not "recoverable" and we usually want to shutdown the broker until problems with the disk are solved. When there's no more space on the disk, we usually want to wait that some space is reclaimed and continue what we have been doing before (exchanging messages). All file-based persistent stores are capable of surviving these kind of errors. Configuring Default IOException handlerThere are a couple of properties you can use to tune the behavior of the Example: <bean id="ioExceptionHandler" class="org.apache.activemq.util.DefaultIOExceptionHandler"> <property name="ignoreAllErrors"><value>true</value></property> </bean> <broker xmlns="http://activemq.apache.org/schema/core" ioExceptionHandler="#ioExceptionHandler"> ... </broker> Handler configuration properties:
The default configuration will try to find a specified string in the exception message to determine whether it is a 'no disk space' error. On most platforms (at least those we have tested), you'll find the word 'space' in it. Of course, you can customize this to your platform by using Note: as of ActiveMQ 5.11 the Writing your own handler In case this handler doesn't work for you, you can write your own. For example you might want to change the way how you detect full disk and execute some external command, like All you have to do is implement the <bean id="ioExceptionHandler" class="com.mycompany.MyIOExceptionHandler"> <property name="ignoreAllErrors"><value>true</value></property> </bean> <broker xmlns="http://activemq.apache.org/schema/core" ioExceptionHandler="#ioExceptionHandler"> ... </broker> |