fix(tasks): background tasks would stop running if disk is over 90% full

This commit is contained in:
Gauthier Roebroeck 2020-05-06 14:43:41 +08:00
parent ff55c84f8e
commit dc33fb1d10

View File

@ -5,6 +5,7 @@ import org.apache.activemq.artemis.core.config.CoreQueueConfiguration
import org.apache.activemq.artemis.core.settings.impl.AddressSettings
import org.springframework.boot.autoconfigure.jms.artemis.ArtemisConfigurationCustomizer
import org.springframework.context.annotation.Configuration
import org.apache.activemq.artemis.core.config.Configuration as ArtemisConfiguration
const val QUEUE_UNIQUE_ID = "unique_id"
const val QUEUE_TYPE = "type"
@ -14,8 +15,10 @@ const val QUEUE_TASKS_SELECTOR = "$QUEUE_TYPE = '$QUEUE_TASKS_TYPE'"
@Configuration
class ArtemisConfig : ArtemisConfigurationCustomizer {
override fun customize(configuration: org.apache.activemq.artemis.core.config.Configuration?) {
override fun customize(configuration: ArtemisConfiguration?) {
configuration?.let {
// default is 90, meaning the queue would block if disk is 90% full. Set it to 100 to avoid blocking.
it.maxDiskUsage = 100
// disable prefetch, ensures messages stay in the queue and last value can have desired effect
it.addAddressesSetting(QUEUE_TASKS, AddressSettings().apply {
defaultConsumerWindowSize = 0